From c88a5f38beada75bbc159066b08dcdba097416b1 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 28 Sep 2014 15:21:21 -0700 Subject: [PATCH 1/2] Disable CURLOPT_FAILONERROR for CheckBucket curl will not consume the body of a response when CURLOPT_FAILONERROR is set. This prevents logging of responses for failed requests. --- src/curl.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index b6613a8..9b70c99 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -1478,7 +1478,6 @@ bool S3fsCurl::RemakeHandle(void) case REQTYPE_CHKBUCKET: curl_easy_setopt(hCurl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(hCurl, CURLOPT_FAILONERROR, true); curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)bodydata); curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); curl_easy_setopt(hCurl, CURLOPT_HTTPHEADER, requestHeaders); @@ -2390,7 +2389,6 @@ int S3fsCurl::CheckBucket(void) } // setopt curl_easy_setopt(hCurl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(hCurl, CURLOPT_FAILONERROR, true); curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)bodydata); curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); curl_easy_setopt(hCurl, CURLOPT_HTTPHEADER, requestHeaders); From 3d69ee0c3033187292229186f5248ec4500bda5a Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 28 Sep 2014 16:12:53 -0700 Subject: [PATCH 2/2] Emit response on failed CheckBucket requests This allows callers to diagnose errors like InvalidAccessKeyId and RequestTimeTooSkewed. --- src/curl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/curl.cpp b/src/curl.cpp index 9b70c99..0195335 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2396,6 +2396,9 @@ int S3fsCurl::CheckBucket(void) type = REQTYPE_CHKBUCKET; int result = RequestPerform(); + if (result != 0) { + DPRN("Check bucket failed, S3 response: %s", (bodydata ? bodydata->str() : "")); + } delete bodydata; bodydata = NULL;