Set CURLOPT_UNRESTRICTED_AUTH when authenticating (#1681)

This is necessary for authentication to work with AWS when it responds with 307 to the check bucket request when mounting. This happens to newly created buckets according to https://aws.amazon.com/premiumsupport/knowledge-center/s3-http-307-response/.

Prior to this, curl would follow the redirect, but would not include the `Authorization` header which would end up with `404`.

Co-authored-by: Takeshi Nakatani <ggtakec@gmail.com>
This commit is contained in:
Jan Stastny 2021-06-25 13:26:12 +02:00 committed by GitHub
parent 6edf3d6427
commit a5c1915772
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3400,6 +3400,7 @@ int S3fsCurl::CheckBucket()
curl_easy_setopt(hCurl, CURLOPT_URL, url.c_str()); curl_easy_setopt(hCurl, CURLOPT_URL, url.c_str());
curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)&bodydata); curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)&bodydata);
curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(hCurl, CURLOPT_UNRESTRICTED_AUTH, 1L);
S3fsCurl::AddUserAgent(hCurl); // put User-Agent S3fsCurl::AddUserAgent(hCurl); // put User-Agent
int result = RequestPerform(); int result = RequestPerform();