mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
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
This commit is contained in:
parent
d58682f28b
commit
a8e751a51a
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user