mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-11 05:54:39 +00:00
f673923629
With the CI occasionally slowing down, we're starting to see again some spurious failures despite the long 1-second timeouts. This reports false positives that are disturbing and doesn't provide as much value as this could. However at this delay it already becomes a pain for developers to wait for the tests to complete. This commit adds support for the new environment variable HAPROXY_TEST_TIMEOUT that will allow anyone to modify the connect, client and server timeouts. It was set to 5 seconds by default, which should be plenty for quite some time in the CI. All relevant values that were 200ms or above were replaced by this one. A few larger values were left as they are special. One test for the set-timeout action that used to rely on a fixed 1-sec value was extended to a fixed 5-sec, as the timeout is normally not reached, but it needs to be known to compare the old and new values.
203 lines
4.6 KiB
Plaintext
203 lines
4.6 KiB
Plaintext
varnishtest "A test to validate Transfer-Encoding header conformance to the spec"
|
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
|
|
feature ignore_unknown_macro
|
|
|
|
server s1 {
|
|
rxreq
|
|
expect req.http.content-length == <undef>
|
|
expect req.http.transfer-encoding == "chunked"
|
|
expect req.bodylen == 0
|
|
expect req.body == ""
|
|
txresp -status 200
|
|
|
|
accept
|
|
rxreq
|
|
expect req.http.content-length == <undef>
|
|
expect req.http.transfer-encoding == "chunked"
|
|
expect req.bodylen == 0
|
|
expect req.body == ""
|
|
txresp -status 200
|
|
|
|
accept
|
|
rxreq
|
|
send "HTTP/1.0 200 Ok\r\n"
|
|
send "Transfer-Encoding: chunked\r\n\r\n"
|
|
send "0\r\n\r\n"
|
|
|
|
accept
|
|
rxreq
|
|
send "HTTP/1.1 200 Ok\r\n"
|
|
send "Transfer-Encoding: chunked\r\n"
|
|
send "Content-Length: 30\r\n\r\n"
|
|
send "0\r\n\r\nResponse splitting attach"
|
|
|
|
accept
|
|
rxreq
|
|
expect req.url == "/1"
|
|
expect req.http.transfer-encoding == "chunked"
|
|
expect req.http.te == "trailers"
|
|
txresp
|
|
|
|
rxreq
|
|
expect req.url == "/2"
|
|
expect req.http.transfer-encoding == "chunked"
|
|
expect req.http.te == <undef>
|
|
txresp
|
|
|
|
rxreq
|
|
expect req.url == "/3"
|
|
expect req.http.transfer-encoding == "chunked"
|
|
expect req.http.te == <undef>
|
|
txresp
|
|
} -start
|
|
|
|
server s2 {
|
|
rxreq
|
|
txresp -nolen \
|
|
-hdr "Transfer-Encoding: chunked, chunked" \
|
|
-body "0\r\n\r\n"
|
|
|
|
accept
|
|
rxreq
|
|
txresp -nolen \
|
|
-hdr "Transfer-Encoding: chunked, gzip, chunked" \
|
|
-body "0\r\n\r\n"
|
|
|
|
accept
|
|
rxreq
|
|
txresp -nolen \
|
|
-hdr "Transfer-Encoding: chunked, gzip" \
|
|
-body "0\r\n\r\n"
|
|
|
|
accept
|
|
rxreq
|
|
txresp \
|
|
-hdr "Transfer-Encoding: gzip"
|
|
} -start
|
|
|
|
haproxy h1 -conf {
|
|
defaults
|
|
mode http
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
listen fe1
|
|
bind "fd@${fe1}"
|
|
server s1 ${s1_addr}:${s1_port}
|
|
|
|
listen fe2
|
|
bind "fd@${fe2}"
|
|
server s2 ${s2_addr}:${s2_port}
|
|
} -start
|
|
|
|
client c1 -connect ${h1_fe1_sock} {
|
|
txreq -method POST -nolen \
|
|
-hdr "Transfer-Encoding: chunked" \
|
|
-hdr "Content-Length: 31" \
|
|
-body "0\r\n\r\nGET /smuggled HTTP/1.1\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.http.connection == "close"
|
|
expect_close
|
|
} -run
|
|
|
|
client c2 -connect ${h1_fe1_sock} {
|
|
send "POST / HTTP/1.0\r\n"
|
|
send "Transfer-Encoding: chunked\r\n\r\n"
|
|
send "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect_close
|
|
} -run
|
|
|
|
client c3 -connect ${h1_fe1_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.http.content-length == <undef>
|
|
expect resp.http.transfer-encoding == "chunked"
|
|
expect resp.bodylen == 0
|
|
expect resp.body == ""
|
|
expect_close
|
|
} -run
|
|
|
|
client c4 -connect ${h1_fe1_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.http.content-length == <undef>
|
|
expect resp.http.transfer-encoding == "chunked"
|
|
expect resp.bodylen == 0
|
|
expect resp.body == ""
|
|
} -run
|
|
|
|
client c5 -connect ${h1_fe1_sock} {
|
|
txreq -method POST -url "/1" -nolen \
|
|
-hdr "Transfer-Encoding: chunked" \
|
|
-hdr "TE: trailers, gzip" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 200
|
|
|
|
txreq -method POST -url "/2" -nolen \
|
|
-hdr "Transfer-Encoding: chunked" \
|
|
-hdr "TE: gzip" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 200
|
|
|
|
txreq -method POST -url "/3" -nolen \
|
|
-hdr "Transfer-Encoding: chunked" \
|
|
-hdr "TE: trailers;q=0.5" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 200
|
|
} -run
|
|
|
|
client c6 -connect ${h1_fe1_sock} {
|
|
txreq -nolen \
|
|
-hdr "Transfer-Encoding: chunked, chunked" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 400
|
|
} -run
|
|
|
|
client c7 -connect ${h1_fe1_sock} {
|
|
txreq -nolen \
|
|
-hdr "Transfer-Encoding: chunked, gzip, chunked" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 400
|
|
} -run
|
|
|
|
client c8 -connect ${h1_fe1_sock} {
|
|
txreq -nolen \
|
|
-hdr "Transfer-Encoding: chunked, gzip" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 400
|
|
} -run
|
|
|
|
client c9 -connect ${h1_fe1_sock} {
|
|
txreq \
|
|
-hdr "Transfer-Encoding: gzip"
|
|
rxresp
|
|
expect resp.status == 400
|
|
} -run
|
|
|
|
client c10 -connect ${h1_fe1_sock} {
|
|
txreq -nolen \
|
|
-hdr "Transfer-Encoding: gzip, chunked" \
|
|
-body "0\r\n\r\n"
|
|
rxresp
|
|
expect resp.status == 422
|
|
} -run
|
|
|
|
client c11 -connect ${h1_fe2_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.status == 502
|
|
} -run -repeat 4
|