Log messages for 5xx and 4xx HTTP response code

This commit is contained in:
root 2018-07-04 03:50:45 -04:00
parent 3e4002df0d
commit 92a4034c5e

View File

@ -2063,6 +2063,7 @@ int S3fsCurl::RequestPerform(void)
return 0; return 0;
} }
if(500 <= LastResponseCode){ if(500 <= LastResponseCode){
S3FS_PRN_ERR("HTTP response code = %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
S3FS_PRN_INFO3("HTTP response code %ld", LastResponseCode); S3FS_PRN_INFO3("HTTP response code %ld", LastResponseCode);
sleep(4); sleep(4);
break; break;
@ -2071,21 +2072,25 @@ int S3fsCurl::RequestPerform(void)
// Service response codes which are >= 400 && < 500 // Service response codes which are >= 400 && < 500
switch(LastResponseCode){ switch(LastResponseCode){
case 400: case 400:
S3FS_PRN_ERR("HTTP response code %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
S3FS_PRN_INFO3("HTTP response code 400 was returned, returning EIO."); S3FS_PRN_INFO3("HTTP response code 400 was returned, returning EIO.");
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
return -EIO; return -EIO;
case 403: case 403:
S3FS_PRN_ERR("HTTP response code %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
S3FS_PRN_INFO3("HTTP response code 403 was returned, returning EPERM"); S3FS_PRN_INFO3("HTTP response code 403 was returned, returning EPERM");
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
return -EPERM; return -EPERM;
case 404: case 404:
S3FS_PRN_ERR("HTTP response code %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
S3FS_PRN_INFO3("HTTP response code 404 was returned, returning ENOENT"); S3FS_PRN_INFO3("HTTP response code 404 was returned, returning ENOENT");
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
return -ENOENT; return -ENOENT;
default: default:
S3FS_PRN_ERR("HTTP response code %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
S3FS_PRN_INFO3("HTTP response code = %ld, returning EIO", LastResponseCode); S3FS_PRN_INFO3("HTTP response code = %ld, returning EIO", LastResponseCode);
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
return -EIO; return -EIO;