mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05: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. */
|
is non-headers. */
|
||||||
if(k->str && !k->header && (nread > 0 || is_empty_data)) {
|
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
|
#ifndef CURL_DISABLE_HTTP
|
||||||
if(0 == k->bodywrites && !is_empty_data) {
|
if(0 == k->bodywrites && !is_empty_data) {
|
||||||
/* These checks are only made the first time we are about to
|
/* These checks are only made the first time we are about to
|
||||||
|
@ -30,6 +30,10 @@ data to
|
|||||||
|
|
||||||
verify
|
verify
|
||||||
</data>
|
</data>
|
||||||
|
# make sure no data is written
|
||||||
|
<datacheck nonewline="yes">
|
||||||
|
|
||||||
|
</datacheck>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -58,5 +62,8 @@ Host: %HOSTIP:%HTTPPORT
|
|||||||
Accept: */*
|
Accept: */*
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
<errorcode>
|
||||||
|
8
|
||||||
|
</errorcode>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
Loading…
Reference in New Issue
Block a user