Loading RELEASE-NOTES +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ This release includes the following changes: o pop3: Added support for apop authentication o Added support for Schannel (Native Windows) SSL/TLS encryption [2] o Added support for Darwin SSL (Native Mac OS X and iOS) [6] o http: print reason phrase from HTTP status line on error [8] This release includes the following bugfixes: Loading Loading @@ -68,3 +69,4 @@ References to bug reports and discussions on issues: [5] = http://daniel.haxx.se/blog/2012/06/03/curling-the-metalink/ [6] = http://daniel.haxx.se/blog/2012/06/28/darwin-native-ssl-for-curl/ [7] = http://daniel.haxx.se/blog/2012/07/08/curls-new-http-cookies-docs/ [8] = https://bugzilla.redhat.com/676596 lib/http.c +37 −2 Original line number Diff line number Diff line Loading @@ -2726,6 +2726,42 @@ static CURLcode header_append(struct SessionHandle *data, return CURLE_OK; } static void print_http_error(struct SessionHandle *data) { struct SingleRequest *k = &data->req; char *beg = k->p; /* make sure that data->req.p points to the HTTP status line */ if(!strncmp(beg, "HTTP", 4)) { /* skip to HTTP status code */ beg = strchr(beg, ' '); if(beg && *++beg) { /* find trailing CR */ char end_char = '\r'; char *end = strchr(beg, end_char); if(!end) { /* try to find LF (workaround for non-compliant HTTP servers) */ end_char = '\n'; end = strchr(beg, end_char); } if(end) { /* temporarily replace CR or LF by NUL and print the error message */ *end = '\0'; failf(data, "The requested URL returned error: %s", beg); /* restore the previously replaced CR or LF */ *end = end_char; return; } } } /* fall-back to printing the HTTP status code only */ failf(data, "The requested URL returned error: %d", k->httpcode); } /* * Read any HTTP header lines from the server and pass them to the client app. Loading Loading @@ -3114,8 +3150,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, } else { /* serious error, go home! */ failf (data, "The requested URL returned error: %d", k->httpcode); print_http_error(data); return CURLE_HTTP_RETURNED_ERROR; } } Loading tests/data/test24 +4 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ http HTTP GET fail silently on HTTP error return </name> <command> http://%HOSTIP:%HTTPPORT/24 --fail http://%HOSTIP:%HTTPPORT/24 --fail --silent --show-error </command> </client> Loading @@ -43,5 +43,8 @@ Accept: */* <errorcode> 22 </errorcode> <file2 name="log/stderr24"> curl: (22) The requested URL returned error: 404 BAD BOY </file2> </verify> </testcase> Loading
RELEASE-NOTES +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ This release includes the following changes: o pop3: Added support for apop authentication o Added support for Schannel (Native Windows) SSL/TLS encryption [2] o Added support for Darwin SSL (Native Mac OS X and iOS) [6] o http: print reason phrase from HTTP status line on error [8] This release includes the following bugfixes: Loading Loading @@ -68,3 +69,4 @@ References to bug reports and discussions on issues: [5] = http://daniel.haxx.se/blog/2012/06/03/curling-the-metalink/ [6] = http://daniel.haxx.se/blog/2012/06/28/darwin-native-ssl-for-curl/ [7] = http://daniel.haxx.se/blog/2012/07/08/curls-new-http-cookies-docs/ [8] = https://bugzilla.redhat.com/676596
lib/http.c +37 −2 Original line number Diff line number Diff line Loading @@ -2726,6 +2726,42 @@ static CURLcode header_append(struct SessionHandle *data, return CURLE_OK; } static void print_http_error(struct SessionHandle *data) { struct SingleRequest *k = &data->req; char *beg = k->p; /* make sure that data->req.p points to the HTTP status line */ if(!strncmp(beg, "HTTP", 4)) { /* skip to HTTP status code */ beg = strchr(beg, ' '); if(beg && *++beg) { /* find trailing CR */ char end_char = '\r'; char *end = strchr(beg, end_char); if(!end) { /* try to find LF (workaround for non-compliant HTTP servers) */ end_char = '\n'; end = strchr(beg, end_char); } if(end) { /* temporarily replace CR or LF by NUL and print the error message */ *end = '\0'; failf(data, "The requested URL returned error: %s", beg); /* restore the previously replaced CR or LF */ *end = end_char; return; } } } /* fall-back to printing the HTTP status code only */ failf(data, "The requested URL returned error: %d", k->httpcode); } /* * Read any HTTP header lines from the server and pass them to the client app. Loading Loading @@ -3114,8 +3150,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, } else { /* serious error, go home! */ failf (data, "The requested URL returned error: %d", k->httpcode); print_http_error(data); return CURLE_HTTP_RETURNED_ERROR; } } Loading
tests/data/test24 +4 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ http HTTP GET fail silently on HTTP error return </name> <command> http://%HOSTIP:%HTTPPORT/24 --fail http://%HOSTIP:%HTTPPORT/24 --fail --silent --show-error </command> </client> Loading @@ -43,5 +43,8 @@ Accept: */* <errorcode> 22 </errorcode> <file2 name="log/stderr24"> curl: (22) The requested URL returned error: 404 BAD BOY </file2> </verify> </testcase>