Commit a8e751a5 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

http: refuse to pass on response body with NO_NODY was set

... like when a HTTP/0.9 response comes back without any headers at all
and just a body this now prevents that body from being sent to the
callback etc.

Adapted test 1144 to verify.

Fixes #973

Assisted-by: Ray Satiro
parent d58682f2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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
+7 −0
Original line number Diff line number Diff line
@@ -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>