aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/transfer.c7
-rw-r--r--tests/data/test11447
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 2fad6f32f..24bdf2155 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -535,6 +535,13 @@ static CURLcode readwrite_data(struct Curl_easy *data,
is non-headers. */
if(k->str && !k->header && (nread > 0 || is_empty_data)) {
+ if(data->set.opt_no_body) {
+ /* data arrives although we want none, bail out */
+ streamclose(conn, "ignoring body");
+ *done = TRUE;
+ return CURLE_WEIRD_SERVER_REPLY;
+ }
+
#ifndef CURL_DISABLE_HTTP
if(0 == k->bodywrites && !is_empty_data) {
/* These checks are only made the first time we are about to
diff --git a/tests/data/test1144 b/tests/data/test1144
index 3b4a1b479..3fb90936a 100644
--- a/tests/data/test1144
+++ b/tests/data/test1144
@@ -30,6 +30,10 @@ data to
verify
</data>
+# make sure no data is written
+<datacheck nonewline="yes">
+
+</datacheck>
</reply>
#
@@ -58,5 +62,8 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
+<errorcode>
+8
+</errorcode>
</verify>
</testcase>