Changeset 149672 in webkit
- Timestamp:
- May 7, 2013 8:53:34 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r149669 r149672 1 2013-05-07 peavo@outlook.com <peavo@outlook.com> 2 3 [Curl] POST requests sometimes fail. 4 https://bugs.webkit.org/show_bug.cgi?id=111844 5 6 Reviewed by Brent Fulgham. 7 8 Curl adds the header 'Expect: 100-Continue' when sending a POST request. 9 When we receive the header 'HTTP/1.1 100 Continue', we should not call 10 ResourceHandleClient::didReceiveResponse(), as this will cancel the request, 11 because the MIME type is empty in this case, causing the POST request to fail. 12 This header is only sent as an info header, or provisional response. 13 14 In addition, this patch changes the classification of http code 304 (Not modified). 15 It is not reported as a redirect anymore, but as a response 16 (ResourceHandleClient::didReceiveResponse() is called. 17 18 * platform/network/curl/ResourceHandleManager.cpp: 19 (WebCore::isHttpInfo): Added helper method to determine if http code is http info. 20 (WebCore::isHttpRedirect): Added helper method to determine if http code is http redirect. 21 (WebCore::headerCallback): Just return when receiving the header'HTTP/1.1 100 Continue'. 22 1 23 2013-05-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 24 -
trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
r146621 r149672 127 127 } 128 128 129 inline static bool isHttpInfo(int statusCode) 130 { 131 return 100 <= statusCode && statusCode < 200; 132 } 133 134 inline static bool isHttpRedirect(int statusCode) 135 { 136 return 300 <= statusCode && statusCode < 400 && statusCode != 304; 137 } 138 129 139 ResourceHandleManager::ResourceHandleManager() 130 140 : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback) … … 265 275 CURLcode err; 266 276 277 long httpCode = 0; 278 err = curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode); 279 280 if (isHttpInfo(httpCode)) { 281 // Just return when receiving http info, e.g. HTTP/1.1 100 Continue. 282 // If not, the request might be cancelled, because the MIME type will be empty for this response. 283 return totalSize; 284 } 285 267 286 double contentLength = 0; 268 287 err = curl_easy_getinfo(h, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength); … … 273 292 d->m_response.setURL(KURL(ParsedURLString, hdr)); 274 293 275 long httpCode = 0;276 err = curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode);277 294 d->m_response.setHTTPStatusCode(httpCode); 278 279 295 d->m_response.setMimeType(extractMIMETypeFromMediaType(d->m_response.httpHeaderField("Content-Type"))); 280 296 d->m_response.setTextEncodingName(extractCharsetFromMediaType(d->m_response.httpHeaderField("Content-Type"))); … … 282 298 283 299 // HTTP redirection 284 if ( httpCode >= 300 && httpCode < 400) {300 if (isHttpRedirect(httpCode)) { 285 301 String location = d->m_response.httpHeaderField("location"); 286 302 if (!location.isEmpty()) {
Note: See TracChangeset
for help on using the changeset viewer.