return result;
}
else if(checkprefix("Content-Length:", line_start)) {
+ if(k->httpcode/100 == 2) {
+ /* A server MUST NOT send any Transfer-Encoding or
+ Content-Length header fields in a 2xx (Successful)
+ response to CONNECT. (RFC 7231 section 4.3.6) */
+ failf(data, "Content-Length: in %03d response",
+ k->httpcode);
+ return CURLE_RECV_ERROR;
+ }
+
cl = curlx_strtoofft(line_start +
strlen("Content-Length:"), NULL, 10);
}
else if(Curl_compareheader(line_start,
"Transfer-Encoding:",
"chunked")) {
+ if(k->httpcode/100 == 2) {
+ /* A server MUST NOT send any Transfer-Encoding or
+ Content-Length header fields in a 2xx (Successful)
+ response to CONNECT. (RFC 7231 section 4.3.6) */
+ failf(data, "Transfer-Encoding: in %03d response",
+ k->httpcode);
+ return CURLE_RECV_ERROR;
+ }
infof(data, "CONNECT responded chunked\n");
chunked_encoding = TRUE;
/* init our chunky engine */
HTTP/1.1 200 We are fine and cool\r
Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
Content-Length: 27\r
-
+\r
This is all fine and dandy
</data>
+# This is the CONNECT response
<connect1001>
HTTP/1.1 200 We are fine and cool\r
Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
-Content-Length: 27\r
-
-This is all fine and dandy
+\r
</connect1001>
<datacheck>
HTTP/1.1 200 We are fine and cool\r
Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
-Content-Length: 27\r
-
+\r
HTTP/1.1 200 We are fine and cool\r
Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
Content-Length: 27\r
-
+\r
This is all fine and dandy
</datacheck>
</reply>
<connect>
HTTP/1.1 200 welcome dear\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
-Content-Length: 0\r
\r
</connect>
<datacheck>
HTTP/1.1 200 welcome dear\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
-Content-Length: 0\r
\r
HTTP/1.1 200 OK\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r