aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-30 06:40:01 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-30 06:40:01 +0000
commit8e92600ddd6ed324fc1f8410e859cca3182018f7 (patch)
tree5795ba2eb237e16bcfb0513e8b46c7aee1492e2e /lib/transfer.c
parent5e75c310ba0b74ad9dd075710d55bcb1fd58aadb (diff)
David Byron made CURLOPT_FAILONERROR work with authentications such as NTLM
or Digest.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 2a0df0f64..4e5d71137 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -441,6 +441,16 @@ CURLcode Curl_readwrite(struct connectdata *conn,
FD_ZERO(&k->wkeepfd);
}
+ /*
+ ** Now that all of the headers have been parsed, see
+ ** if we should give up and return an error.
+ */
+ if (Curl_http_should_fail(conn)) {
+ failf (data, "The requested URL returned error: %d",
+ k->httpcode);
+ return CURLE_HTTP_RETURNED_ERROR;
+ }
+
/* now, only output this if the header AND body are requested:
*/
writetype = CLIENTWRITE_HEADER;
@@ -576,9 +586,21 @@ CURLcode Curl_readwrite(struct connectdata *conn,
data->info.httpcode = k->httpcode;
data->info.httpversion = k->httpversion;
- /* 404 -> URL not found! */
+ /*
+ ** This code executes as part of processing
+ ** the header. As a result, it's not
+ ** totally clear how to interpret the
+ ** response code yet as that depends on what
+ ** other headers may be present. 401 and
+ ** 407 may be errors, but may be OK
+ ** depending on how authentication is
+ ** working. Other codes are definitely
+ ** errors, so give up here.
+ */
if (data->set.http_fail_on_error &&
- (k->httpcode >= 400)) {
+ (k->httpcode >= 400) &&
+ (k->httpcode != 401) &&
+ (k->httpcode != 407)) {
/* If we have been told to fail hard on HTTP-errors,
here is the check for that: */
/* serious error, go home! */