aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorMichael Kaufmann <mail@michael-kaufmann.ch>2016-09-22 22:15:13 +0200
committerMichael Kaufmann <mail@michael-kaufmann.ch>2016-09-22 22:22:31 +0200
commite9e536619333b0ebd1b096be5c27a39c78e812c5 (patch)
tree44c39aad0c5acc5f0d330653ac214c274afdef38 /lib/http.c
parentd1f1c857ad559eafef9373621d30174c046261ef (diff)
New libcurl option to keep sending on error
Add the new option CURLOPT_KEEP_SENDING_ON_ERROR to control whether sending the request body shall be completed when the server responds early with an error status code. This is suitable for manual NTLM authentication. Reviewed-by: Jay Satiro Closes https://github.com/curl/curl/pull/904
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c21
1 files changed, 15 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;