BUG/MINOR: mux-h2: always compare content-length to the sum of DATA frames
This is mandated by RFC7541#8.1.2.6. Till now we didn't have a copy of
the content-length header field. But now that it's already parsed, it's
easy to add the check.
The reg-test was updated to match the new behaviour as the previous one
expected unadvertised data to be silently discarded.
This should be backported to 1.9 along with previous patch (MEDIUM: h2:
always parse and deduplicate the content-length header) after it has got
a bit more exposure.
diff --git a/reg-tests/http-messaging/h00002.vtc b/reg-tests/http-messaging/h00002.vtc
index d2d0b9d..481aded 100644
--- a/reg-tests/http-messaging/h00002.vtc
+++ b/reg-tests/http-messaging/h00002.vtc
@@ -30,10 +30,7 @@
-body "response 3"
barrier b4 sync
- rxreq
- txresp \
- -status 200 \
- -body "response 4"
+ # the next request is never received
} -repeat 2 -start
haproxy h1 -conf {
@@ -104,23 +101,19 @@
expect resp.body == "response 3"
} -run
- # fourth request is valid and advertises C-L:0, and close, and is
- # followed by a string "this is not sent\r\n\r\n" which must be
- # dropped.
+ # fourth request is valid and advertises C-L:2, and close, and is
+ # followed by a string "this is not sent\r\n\r\n" which causes a
+ # stream error of type PROTOCOL_ERROR.
stream 7 {
barrier b4 sync
txreq \
-req "GET" \
-scheme "https" \
-url "/test4.html" \
- -hdr "content-length" "0" \
+ -hdr "content-length" "2" \
-nostrend
txdata -data "this is sent and ignored"
- rxwinup
- rxhdrs
- expect resp.status == 200
- rxdata -all
- expect resp.body == "response 4"
+ rxrst
} -run
} -run
@@ -250,22 +243,18 @@
expect resp.body == "response 3"
} -run
- # fourth request is valid and advertises C-L:0, and close, and is
- # followed by a string "this is not sent\r\n\r\n" which must be
- # dropped.
+ # fourth request is valid and advertises C-L:2, and close, and is
+ # followed by a string "this is not sent\r\n\r\n" which results
+ # in a stream error.
stream 7 {
barrier b4 sync
txreq \
-req "POST" \
-scheme "https" \
-url "/test24.html" \
- -hdr "content-length" "0" \
+ -hdr "content-length" "2" \
-nostrend
txdata -data "this is sent and ignored"
- rxwinup
- rxhdrs
- expect resp.status == 200
- rxdata -all
- expect resp.body == "response 4"
+ rxrst
} -run
} -run