From 393213d879ebf03d0680333e153bd15339dcf325 Mon Sep 17 00:00:00 2001 From: James White Date: Tue, 19 Nov 2013 13:07:46 +0000 Subject: [PATCH] Fixing issue with HEAD requests not finishing correctly until timing out and taking up slots in pool unnecessarily --- src/downstream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/downstream.c b/src/downstream.c index d20f3be..15c53ec 100644 --- a/src/downstream.c +++ b/src/downstream.c @@ -1474,7 +1474,10 @@ downstream_connection_readcb(evbev_t * bev, void * arg) { evbuffer_drain(evbuf, -1); - if (nread != avail) { + // For HEAD requests only, the 'nread' variable will be incorrect due to + // hooks exiting prematurely to avoid extra processing of body when not required + // This validation is skipped for this reason. + if(request->upstream_request->method != htp_method_HEAD && nread != avail){ /* the request processing was aborted at some point, so * we mark it as an error */