diff --git a/lib/http.c b/lib/http.c index ec9e69f4f2..e6375b92e1 100644 --- a/lib/http.c +++ b/lib/http.c @@ -3410,6 +3410,10 @@ static CURLcode http_rw_headers(struct Curl_easy *data, /* this is not the beginning of a protocol first header line */ k->header = FALSE; streamclose(conn, "bad HTTP: No end-of-message indicator"); + if(conn->httpversion >= 10) { + failf(data, "Invalid status line"); + return CURLE_WEIRD_SERVER_REPLY; + } if(!data->set.http09_allowed) { failf(data, "Received HTTP/0.9 when not allowed"); return CURLE_UNSUPPORTED_PROTOCOL; @@ -3443,6 +3447,10 @@ static CURLcode http_rw_headers(struct Curl_easy *data, if(st == STATUS_BAD) { streamclose(conn, "bad HTTP: No end-of-message indicator"); /* this is not the beginning of a protocol first header line */ + if(conn->httpversion >= 10) { + failf(data, "Invalid status line"); + return CURLE_WEIRD_SERVER_REPLY; + } if(!data->set.http09_allowed) { failf(data, "Received HTTP/0.9 when not allowed"); return CURLE_UNSUPPORTED_PROTOCOL; diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 2d2b87a864..825b56815f 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -188,6 +188,7 @@ test1447 test1448 test1449 test1450 test1451 test1452 test1453 test1454 \ test1455 test1456 test1457 test1458 test1459 test1460 test1461 test1462 \ test1463 test1464 test1465 test1466 test1467 test1468 test1469 test1470 \ test1471 test1472 test1473 test1474 test1475 test1476 test1477 test1478 \ +test1479 test1480 \ \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \ diff --git a/tests/data/test1479 b/tests/data/test1479 new file mode 100644 index 0000000000..9e22e77f4c --- /dev/null +++ b/tests/data/test1479 @@ -0,0 +1,67 @@ + + + +HTTP +HTTP/0.9 + + + +# +# Server-side + + +HTTP/1.1 200 OK +Content-Length: 5 + +Data + + +Data +Data +Data + + + + + +# +# Client-side + + +http + + +HTTP/1.1 response followed by an HTTP/0.9 response over the same connection + + +http://%HOSTIP:%HTTPPORT/%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER0002 + + + +# +# Verify data after the test has been "shot" + + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + +GET /%TESTNUMBER0002 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + +# Hyper curl returns unsupported protocol +# built-in curl returns weird_server_reply + +%if hyper +1 +%else +8 +%endif + + + diff --git a/tests/data/test1480 b/tests/data/test1480 new file mode 100644 index 0000000000..65e0d4a408 --- /dev/null +++ b/tests/data/test1480 @@ -0,0 +1,58 @@ + + + +HTTP + + + +# +# Server-side + + +HTTP/1.1 100 Continue +Foo: Bar + +Data +Data +Data + + + + + +# +# Client-side + + +http + + +HTTP Continue response without final response + + +http://%HOSTIP:%HTTPPORT/%TESTNUMBER + + + +# +# Verify data after the test has been "shot" + + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + +# Hyper curl returns unsupported protocol +# built-in curl returns weird_server_reply + +%if hyper +1 +%else +8 +%endif + + +