| 120 | }; |
| 121 | |
| 122 | void S3RESTfulService::performCurl(CURL *curl, Response &response) { |
| 123 | CURLcode res = curl_easy_perform(curl); |
| 124 | if (res != CURLE_OK) { |
| 125 | if (res == CURLE_COULDNT_RESOLVE_HOST || res == CURLE_COULDNT_RESOLVE_PROXY) { |
| 126 | S3_DIE(S3ResolveError, curl_easy_strerror(res)); |
| 127 | } else if (res == CURLE_COULDNT_CONNECT) { |
| 128 | S3_DIE(S3ConnectionError, "Failed to connect to host or proxy."); |
| 129 | } else { |
| 130 | S3_DIE(S3ConnectionError, curl_easy_strerror(res)); |
| 131 | } |
| 132 | } else { |
| 133 | long responseCode; |
| 134 | // Get the HTTP response status code from HTTP header |
| 135 | curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &responseCode); |
| 136 | |
| 137 | response.FillResponse(responseCode); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // get() will execute HTTP GET RESTful API with given url/headers/params, |
| 142 | // and return raw response content. |
no test coverage detected