aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c21
-rw-r--r--lib/url.c4
-rw-r--r--lib/urldata.h1
3 files changed, 20 insertions, 6 deletions
diff --git a/lib/http.c b/lib/http.c
index 07ad463c9..65c145a13 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -3181,12 +3181,21 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* connection for closure after we've read the entire response.
*/
if(!k->upload_done) {
- infof(data, "HTTP error before end of send, stop sending\n");
- streamclose(conn, "Stop sending data before everything sent");
- k->upload_done = TRUE;
- k->keepon &= ~KEEP_SEND; /* don't send */
- if(data->state.expect100header)
- k->exp100 = EXP100_FAILED;
+ if(data->set.http_keep_sending_on_error) {
+ infof(data, "HTTP error before end of send, keep sending\n");
+ if(k->exp100 > EXP100_SEND_DATA) {
+ k->exp100 = EXP100_SEND_DATA;
+ k->keepon |= KEEP_SEND;
+ }
+ }
+ else {
+ infof(data, "HTTP error before end of send, stop sending\n");
+ streamclose(conn, "Stop sending data before everything sent");
+ k->upload_done = TRUE;
+ k->keepon &= ~KEEP_SEND; /* don't send */
+ if(data->state.expect100header)
+ k->exp100 = EXP100_FAILED;
+ }
}
break;
diff --git a/lib/url.c b/lib/url.c
index f355c7a22..74e9bf5c6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -782,6 +782,10 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
*/
data->set.http_fail_on_error = (0 != va_arg(param, long)) ? TRUE : FALSE;
break;
+ case CURLOPT_KEEP_SENDING_ON_ERROR:
+ data->set.http_keep_sending_on_error = (0 != va_arg(param, long)) ?
+ TRUE : FALSE;
+ break;
case CURLOPT_UPLOAD:
case CURLOPT_PUT:
/*
diff --git a/lib/urldata.h b/lib/urldata.h
index d5efe2a97..fd9870e26 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1611,6 +1611,7 @@ struct UserDefined {
bool ftp_use_port; /* use the FTP PORT command */
bool hide_progress; /* don't use the progress meter */
bool http_fail_on_error; /* fail on HTTP error codes >= 400 */
+ bool http_keep_sending_on_error; /* for HTTP status codes >= 300 */
bool http_follow_location; /* follow HTTP redirects */
bool http_transfer_encoding; /* request compressed HTTP transfer-encoding */
bool http_disable_hostname_check_before_authentication;