]> granicus.if.org Git - apache/commitdiff
ab: Keep reading nonblocking to exhaust TCP or SSL buffers when previous
authorYann Ylavic <ylavic@apache.org>
Tue, 10 Oct 2017 09:09:22 +0000 (09:09 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 10 Oct 2017 09:09:22 +0000 (09:09 +0000)
read was incomplete (the SSL case can cause the next poll() to timeout
since data are buffered already).  PR 61301

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1811649 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/ab.c

diff --git a/CHANGES b/CHANGES
index 2a174e98a196b1e17b26f08f50c0c2bcc60c02a3..e9d54adc6e8a8b49879f3fc158d03577baef2cdd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) ab: Keep reading nonblocking to exhaust TCP or SSL buffers when previous
+     read was incomplete (the SSL case can cause the next poll() to timeout
+     since data are buffered already).  PR 61301 [Luca Toscano, Yann Ylavic]
+
   *) mod_md: v0.9.9, fix for applying challenge type based on available ports. [Stefan Eissing]
 
   *) mod_proxy_uwsgi: New UWSGI mod_proxy (sub)module contributed by unbit.com.
index 118e17b5c86b789a0ba3257d0143fce2746d0d20..d8486ea769437e19eaccfd54afca1a2cc102cb2b 100644 (file)
@@ -1506,6 +1506,7 @@ static void read_connection(struct connection * c)
     int i;
 
     r = sizeof(buffer);
+read_more:
 #ifdef USE_SSL
     if (c->ssl) {
         status = SSL_read(c->ssl, buffer, r);
@@ -1712,6 +1713,10 @@ static void read_connection(struct connection * c)
         c->bread += r;
         totalbread += r;
     }
+    if (r == sizeof(buffer) && c->bread < c->length) {
+        /* read was full, try more immediately (nonblocking already) */
+        goto read_more;
+    }
 
     if (c->keepalive && (c->bread >= c->length)) {
         /* finished a keep-alive connection */