[Pound Mailing List] [PATCH 3/5] Flush the headers to the backend as soon as they are received

Lubomir Rintel <[email protected]>
Newsgroups gmane.comp.web.pound.general
Message-ID <[email protected]>
From: Lubomir Rintel <lubo.rintel-Vz9dX3IBr95Wk0Htik3J/[email protected]>

No need to wait and backend can process them as we read body potentially
slightly increasing performance. Also, if this is a new connection and backend
has aggressive first-byte timeout (such as Varnish in default configuration),
this will prevent the backend from time-ing out when a client has a long delay
between headers and body (as is customary for busy Internet Exporer <= 8).
---
 http.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/http.c b/http.c
index d6196cb..9f8c87d 100644
--- a/http.c
+++ b/http.c
@@ -1164,6 +1164,18 @@ do_http(thr_arg *arg)
             BIO_puts(be, "\r\n");
         }
 
+        /* flush to the back-end */
+        if(cur_backend->be_type == 0 && BIO_flush(be) != 1) {
+            str_be(buf, MAXBUF - 1, cur_backend);
+            end_req = cur_time();
+            addr2str(caddr, MAXBUF - 1, &from_host, 1);
+            logmsg(LOG_NOTICE, "(%lx) e500 for %s error flush to %s/%s: %s (%.3f sec)",
+                pthread_self(), caddr, buf, request, strerror(errno), (end_req - start_req) / 1000000.0);
+            err_reply(cl, h500, lstn->err500);
+            clean_all();
+            return;
+        }
+
         if(cl_11 && chunked) {
             /* had Transfer-encoding: chunked so read/write all the chunks (HTTP/1.1 only) */
             if(copy_chunks(cl, be, NULL, cur_backend->be_type, lstn->max_req)) {
-- 
1.9.3


--
To unsubscribe send an email with subject unsubscribe to [email protected]
Please contact [email protected] for questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.