httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sung Kim <hun...@cse.ucsc.edu>
Subject [patch] apache benchmark patch to support all methods
Date Fri, 30 Aug 2002 04:53:46 GMT
Hello,

This is a apache bench patch. Since ab support only HEAD, GET and POST, I added -m option
to specify methods so that we can do PROFIND or PROPATCH benchmark using ab.

Index: ab.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/support/ab.c,v
retrieving revision 1.116
diff -u -r1.116 ab.c
--- ab.c	3 Aug 2002 22:01:40 -0000	1.116
+++ ab.c	30 Aug 2002 04:48:02 -0000
@@ -300,6 +300,7 @@
 char *gnuplot;			/* GNUplot file */
 char *csvperc;			/* CSV Percentile file */
 char url[1024];
+char method[256]="GET";         /* Method name. Default is GET */
 char * fullurl, * colonhost;
 int isproxy = 0;
 apr_interval_time_t aprtimeout = apr_time_from_sec(30);	/* timeout value */
@@ -1573,14 +1574,14 @@
 		"Host: %s%s\r\n"
 		"Accept: */*\r\n"
 		"%s" "\r\n",
-		(posting == 0) ? "GET" : "HEAD",
+		(posting == 0) ? method : "HEAD",
 		(isproxy) ? fullurl : path,
 		AP_AB_BASEREVISION,
 		keepalive ? "Connection: Keep-Alive\r\n" : "",
 		cookie, auth, host_field, colonhost, hdrs);
     }
     else {
-	sprintf(request, "POST %s HTTP/1.0\r\n"
+	sprintf(request, "%s %s HTTP/1.0\r\n"
 		"User-Agent: ApacheBench/%s\r\n"
 		"%s" "%s" "%s"
 		"Host: %s%s\r\n"
@@ -1589,6 +1590,7 @@
 		"Content-type: %s\r\n"
 		"%s"
 		"\r\n",
+		method,
 		(isproxy) ? fullurl : path,
 		AP_AB_BASEREVISION,
 		keepalive ? "Connection: Keep-Alive\r\n" : "",
@@ -1765,7 +1767,8 @@
     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 containing data to POST\n");
+    fprintf(stderr, "    -p postfile     File containing data to POST, PUT or etc\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");
@@ -1954,7 +1957,7 @@
 #endif

     apr_getopt_init(&opt, cntxt, argc, argv);
-    while ((status = apr_getopt(opt, "n:c:t:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq"
+    while ((status = apr_getopt(opt, "n:c:t:T:p:v:m:kVhwix:y:z:C:H:P:A:g:X:de:Sq"
 #ifdef USE_SSL
 				"s"
 #endif
@@ -2021,6 +2024,9 @@
 	    break;
 	case 'T':
 	    strcpy(content_type, optarg);
+	    break;
+	case 'm': /* method */
+	    strcpy(method, optarg);
 	    break;
 	case 'C':
 	    strncat(cookie, "Cookie: ", sizeof(cookie));

--
Sung Kim <hunkim@cse.ucsc.edu>
http://www.cse.ucsc.edu/~hunkim

 "Dreams become reality!"


Mime
View raw message