@@ -369,7 +369,7 @@ BatchResponse PerformBatchUploadRequest(const std::string& serverUrl, const Cred
369369 return result;
370370}
371371
372- Communicator::UploadResult PerformUpload (const std::string& uploadUrl, const std::vector<char >& fileContents, const std::map<std::string, std::string>& actionHeaders)
372+ Communicator::UploadResult PerformUpload (const std::string& uploadUrl, const std::vector<char >& fileContents, const std::map<std::string, std::string>& actionHeaders, const Credentials& auth = Credentials() )
373373{
374374 // Initialize curl
375375 CURLHandle curl;
@@ -394,7 +394,7 @@ Communicator::UploadResult PerformUpload(const std::string& uploadUrl, const std
394394 uploadHeaders = CreateHeadersFromMap (actionHeaders, uploadHeaders);
395395
396396 RequestResult uploadResult = {};
397- SetupRequest (curl.get (), uploadUrl, fileContents.data (), fileContents.size (), uploadHeaders, &uploadResult);
397+ SetupRequest (curl.get (), uploadUrl, fileContents.data (), fileContents.size (), uploadHeaders, &uploadResult, auth );
398398 curl_easy_setopt (curl.get (), CURLOPT_CUSTOMREQUEST, " PUT" );
399399
400400 uploadResult = PerformRequestWithRetry ([&]() -> RequestResult
@@ -436,7 +436,7 @@ std::string CreateVerifyPayload(const std::string& oid, size_t fileSize)
436436 return verifyBuffer.GetString ();
437437}
438438
439- bool PerformVerify (const std::string& verifyUrl, const std::string& oid, size_t fileSize, const std::map<std::string, std::string>& actionHeaders)
439+ bool PerformVerify (const std::string& verifyUrl, const std::string& oid, size_t fileSize, const std::map<std::string, std::string>& actionHeaders, const Credentials& auth = Credentials() )
440440{
441441 CURLHandle curl;
442442 if (!curl)
@@ -453,7 +453,7 @@ bool PerformVerify(const std::string& verifyUrl, const std::string& oid, size_t
453453
454454 // Perform request without authentication (headers from action should contain auth)
455455 RequestResult verifyResult = {};
456- SetupRequest (curl.get (), verifyUrl, verifyPayload.data (), verifyPayload.size (), verifyHeaders, &verifyResult);
456+ SetupRequest (curl.get (), verifyUrl, verifyPayload.data (), verifyPayload.size (), verifyHeaders, &verifyResult, auth );
457457
458458 verifyResult = PerformRequestWithRetry ([&]() -> RequestResult
459459 {
@@ -492,15 +492,15 @@ Communicator::UploadResult LFSComm::UploadFile(const std::vector<char>& fileCont
492492 return UploadResult::AlreadyExists;
493493 }
494494
495- auto uploadResult = PerformUpload (batchResponse.uploadUrl , fileContents, batchResponse.uploadHeaders );
495+ auto uploadResult = PerformUpload (batchResponse.uploadUrl , fileContents, batchResponse.uploadHeaders , m_Creds );
496496 if (uploadResult != UploadResult::Uploaded)
497497 {
498498 return uploadResult;
499499 }
500500
501501 if (!batchResponse.verifyUrl .empty ())
502502 {
503- if (!PerformVerify (batchResponse.verifyUrl , oid, fileContents.size (), batchResponse.verifyHeaders ))
503+ if (!PerformVerify (batchResponse.verifyUrl , oid, fileContents.size (), batchResponse.verifyHeaders , m_Creds ))
504504 {
505505 return UploadResult::Error;
506506 }
0 commit comments