--- /dev/null
+varnishtest "H1 response to a GET turned into a HEAD by the configuration"
+
+# When the request method is changed from GET to HEAD, the response from the
+# server has no payload but the client expects one: the connection must be
+# closed instead of being kept alive.
+
+feature ignore_unknown_macro
+
+server s1 {
+ rxreq
+ expect req.method == "HEAD"
+ txresp -nolen -hdr "Content-Length: 1234"
+} -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 li1
+ bind "fd@${li1}"
+ http-request set-method HEAD
+ server s1 ${s1_addr}:${s1_port}
+} -start
+
+client c1 -connect ${h1_li1_sock} {
+ txreq -req GET -url /
+ rxresp -no_obj
+ expect resp.status == 200
+ expect resp.http.content-length == "1234"
+ expect resp.http.connection == "close"
+ expect_close
+} -run
if (sl->flags & HTX_SL_F_XFER_ENC)
h1m->flags |= H1_MF_XFER_ENC;
}
+
if (h1s->status < 200)
h1s->flags |= H1S_F_HAVE_O_CONN;
- else if ((sl->flags & HTX_SL_F_BODYLESS_RESP) || h1s->status == 204 || h1s->status == 304)
+ else if (h1s->status == 204 || h1s->status == 304)
h1s->flags |= H1S_F_BODYLESS_RESP;
/* The chunked transfer-coding must not be used in a response to an