httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r516175 - in /httpd/httpd/trunk: CHANGES support/ab.c
Date Thu, 08 Mar 2007 21:00:08 GMT
Author: trawick
Date: Thu Mar  8 13:00:07 2007
New Revision: 516175

URL: http://svn.apache.org/viewvc?view=rev&rev=516175
Log:
ab: Add -r option to continue after socket receive errors.

Submitted by: Filip Hanik <devlist hanik.com>
Reviewed by: trawick


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/support/ab.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?view=diff&rev=516175&r1=516174&r2=516175
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Mar  8 13:00:07 2007
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) ab: Add -r option to continue after socket receive errors. 
+     [Filip Hanik <devlist hanik.com>]
+
   *) mod_ldap: Fix the search limit parameter to ldap_search_ext_s()
      for SDKs that define LDAP_NO_LIMIT to something other than -1.
      [David Jones <oscaremma gmail.com>]

Modified: httpd/httpd/trunk/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?view=diff&rev=516175&r1=516174&r2=516175
==============================================================================
--- httpd/httpd/trunk/support/ab.c (original)
+++ httpd/httpd/trunk/support/ab.c Thu Mar  8 13:00:07 2007
@@ -258,6 +258,7 @@
 /* --------------------- GLOBALS ---------------------------- */
 
 int verbosity = 0;      /* no verbosity by default */
+int recverrok = 0;      /* ok to proceed after socket receive errors */
 int posting = 0;        /* GET by default */
 int requests = 1;       /* Number of requests to make */
 int heartbeatres = 100; /* How often do we say we're alive */
@@ -317,7 +318,7 @@
 #endif
 
 /* store error cases */
-int err_length = 0, err_conn = 0, err_except = 0;
+int err_length = 0, err_conn = 0, err_recv = 0, err_except = 0;
 int err_response = 0;
 
 apr_time_t start, endtime;
@@ -760,8 +761,8 @@
     printf("Complete requests:      %ld\n", done);
     printf("Failed requests:        %ld\n", bad);
     if (bad)
-        printf("   (Connect: %d, Length: %d, Exceptions: %d)\n",
-            err_conn, err_length, err_except);
+        printf("   (Connect: %d, Receive: %d, Length: %d, Exceptions: %d)\n",
+            err_conn, err_recv, err_length, err_except);
     printf("Write errors:           %ld\n", epipe);
     if (err_response)
         printf("Non-2xx responses:      %d\n", err_response);
@@ -1329,10 +1330,18 @@
         }
         /* catch legitimate fatal apr_socket_recv errors */
         else if (status != APR_SUCCESS) {
-            err_except++; /* XXX: is this the right error counter? */
-            /* XXX: Should errors here be fatal, or should we allow a
-             * certain number of them before completely failing? -aaron */
-            apr_err("apr_socket_recv", status);
+            err_recv++;
+            if (recverrok) {
+                bad++;
+                close_connection(c);
+                if (verbosity >= 1) {
+                    char buf[120];
+                    fprintf(stderr,"%s: %s (%d)\n", "apr_socket_recv", apr_strerror(status,
buf, sizeof buf), status);
+                }
+                return;
+            } else {
+                apr_err("apr_socket_recv", status);
+            }
         }
     }
 
@@ -1819,6 +1828,7 @@
     fprintf(stderr, "    -S              Do not show confidence estimators and warnings.\n");
     fprintf(stderr, "    -g filename     Output collected data to gnuplot format file.\n");
     fprintf(stderr, "    -e filename     Output CSV file with percentages served\n");
+    fprintf(stderr, "    -r              Don't exit on socket receive errors.\n");
     fprintf(stderr, "    -h              Display usage information (this message)\n");
 #ifdef USE_SSL
     fprintf(stderr, "    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)\n");
@@ -1981,7 +1991,7 @@
 #endif
 
     apr_getopt_init(&opt, cntxt, argc, argv);
-    while ((status = apr_getopt(opt, "n:c:t:b:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq"
+    while ((status = apr_getopt(opt, "n:c:t:b:T:p:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
 #ifdef USE_SSL
             "Z:f:"
 #endif
@@ -2031,6 +2041,9 @@
                 else if (postdata) {
                     exit(r);
                 }
+                break;
+            case 'r':
+                recverrok = 1;
                 break;
             case 'v':
                 verbosity = atoi(optarg);



Mime
View raw message