Needed to do things like PUT and PROPFIND from ab. This patch
may be of use to some. Not in anywhere near to a state to be commited.

Dw

Index: src/support/ab.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/support/ab.c,v
retrieving revision 1.70
diff -u -r1.70 ab.c
--- src/support/ab.c    31 Jul 2003 20:30:26 -0000      1.70
+++ src/support/ab.c    18 Dec 2003 14:26:57 -0000
@@ -249,6 +249,7 @@
 int proxyport = 0;             /* proxy port */
 int isproxy = 0;
 char path[1024];               /* path name */
+char method[256]="GET";                /* Method name, default is GET */
 char postfile[1024];           /* name of file containing post data */
 char *postdata;                        /* *buffer containing data from postfile */
 char *gnuplot;                 /* GNUplot file */
@@ -1262,7 +1263,7 @@
                     "Host: %s%s\r\n"
                     "Accept: */*\r\n"
                     "%s" "\r\n",
-                    (posting == 0) ? "GET" : "HEAD",
+                    method,
                     url_on_request,
                     VERSION,
                     keepalive ? "Connection: Keep-Alive\r\n" : "",
@@ -1271,7 +1272,7 @@
     }
     else {
         ap_snprintf(request, sizeof(request),
-                    "POST %s HTTP/1.0\r\n"
+                    "%s %s HTTP/1.0\r\n"
                     "User-Agent: ApacheBench/%s\r\n"
                     "%s" "%s" "%s"
                     "Host: %s%s\r\n"
@@ -1280,6 +1281,7 @@
                     "Content-type: %s\r\n"
                     "%s"
                     "\r\n",
+                   method,
                     url_on_request,
                     VERSION,
                     keepalive ? "Connection: Keep-Alive\r\n" : "",
@@ -1384,11 +1386,11 @@
     fprintf(stderr, "    -n requests     Number of requests to perform\n");
     fprintf(stderr, "    -c concurrency  Number of multiple requests to make\n");
     fprintf(stderr, "    -t timelimit    Seconds to max. wait for responses\n");
-    fprintf(stderr, "    -p postfile     File containg data to POST\n");
+    fprintf(stderr, "    -p postfile     File containg data to post in body (use -m 
POST for posting)\n");
+    fprintf(stderr, "    -m method      Method to test\n");
     fprintf(stderr, "    -T content-type Content-type header for POSTing\n");
     fprintf(stderr, "    -v verbosity    How much troubleshooting info to print\n");
     fprintf(stderr, "    -w              Print out results in HTML tables\n");
-    fprintf(stderr, "    -i              Use HEAD instead of GET\n");
     fprintf(stderr, "    -x attributes   String to insert as table attributes\n");
     fprintf(stderr, "    -y attributes   String to insert as tr attributes\n");
     fprintf(stderr, "    -z attributes   String to insert as td or th attributes\n");
@@ -1515,7 +1517,7 @@
     hdrs[0] = '\0';
     proxyhost[0] = '\0';
     optind = 1;
-    while ((c = getopt(argc, argv, "n:c:t:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq"
+    while ((c = getopt(argc, argv, "n:c:t:T:p:v:m:kVhwx:y:z:C:H:P:A:g:X:de:Sq"
 #ifdef USE_SSL
                       "s"
 #endif
@@ -1538,6 +1540,9 @@
        case 'k':
            keepalive = 1;
            break;
+       case 'm':
+           strncpy(method,optarg,sizeof(method));
+           break;
        case 'c':
            concurrency = atoi(optarg);
            break;
@@ -1553,16 +1558,7 @@
        case 'S':
            confidence = 0;
            break;
-       case 'i':
-           if (posting == 1)
-               err("Cannot mix POST and HEAD");
-
-           posting = -1;
-           break;
        case 'p':
-           if (posting != 0)
-               err("Cannot mix POST and HEAD");
-
            if (0 == (r = open_postfile(optarg))) {
                posting = 1;
            }

Reply via email to