]> granicus.if.org Git - apache/commitdiff
ab: follow up to r1811664.
authorYann Ylavic <ylavic@apache.org>
Thu, 2 Nov 2017 22:19:23 +0000 (22:19 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 2 Nov 2017 22:19:23 +0000 (22:19 +0000)
apr_socket_send() can return both an error and data, account for data in
the latter case (i.e. let next call fail, if any).

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

support/ab.c

index 89310a0df8cf47ab1113b393d8016ff09d898ad0..38ebb3dcc2bd87bbc3352dc0fb17e8d8bf452d63 100644 (file)
@@ -845,23 +845,21 @@ static void write_request(struct connection * c)
                 return;
             }
             l = e;
-            e = APR_SUCCESS;
         }
         else
 #endif
         {
             e = apr_socket_send(c->aprsock, request + c->rwrote, &l);
-            if (e != APR_SUCCESS) {
+            if (e != APR_SUCCESS && !l) {
                 if (!APR_STATUS_IS_EAGAIN(e)) {
                     epipe++;
                     printf("Send request failed!\n");
                     close_connection(c);
-                    return;
                 }
-                if (!l) {
+                else {
                     set_polled_events(c, APR_POLLOUT);
-                    return;
                 }
+                return;
             }
         }
         totalposted += l;