mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: cache/htx: Return only the headers of cached objects to HEAD requests
The body of a cached object must not be sent in response to a HEAD request. This works for the legacy HTTP because the parsing is performed by HTTP analyzers _AND_ because the connection is closed at the end of the transaction. So the body is ignored. But the applet send it. For the HTX, the applet must skip the body explicitly. This patch must be backported to 1.9.
This commit is contained in:
parent
b3d4bca415
commit
f0dd037456
@ -1023,7 +1023,11 @@ static void htx_cache_io_handler(struct appctx *appctx)
|
||||
goto error;
|
||||
|
||||
total += ret;
|
||||
if (cache_ptr->data_len)
|
||||
if (si_strm(si)->txn->meth == HTTP_METH_HEAD) {
|
||||
/* Skip response body for HEAD requests */
|
||||
appctx->st0 = HTX_CACHE_EOM;
|
||||
}
|
||||
else if (cache_ptr->data_len)
|
||||
appctx->st0 = HTX_CACHE_DATA;
|
||||
else if (first->len > sizeof(*cache_ptr) + appctx->ctx.cache.sent) {
|
||||
/* Headers have benn sent (hrds_len) and there is no data
|
||||
|
Loading…
Reference in New Issue
Block a user