diff options
author | Yann Ylavic <ylavic@apache.org> | 2014-06-07 08:45:56 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2014-06-07 08:45:56 +0000 |
commit | f0f9b0bfb3fd2b2648d73e7c1df1f097f85570c6 (patch) | |
tree | 53b8dd2897b50d097c47bf47d424b8a1678b3fa8 /support/ab.c | |
parent | 81075f39421b8a8ada2bc84ab2e3b96590a486ee (diff) | |
download | httpd-f0f9b0bfb3fd2b2648d73e7c1df1f097f85570c6.tar.gz |
ab: support custom HTTP method with -m argument. PR 56604.
Example: ab -n 1 -m PING http://127.0.0.1/
Submitted By: Roman Jurkov <winfinit gmail com>
Committed By: ylavic
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/ab.c')
-rw-r--r-- | support/ab.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/support/ab.c b/support/ab.c index 32837052ef..f9888e1592 100644 --- a/support/ab.c +++ b/support/ab.c @@ -266,14 +266,14 @@ struct data { int verbosity = 0; /* no verbosity by default */ int recverrok = 0; /* ok to proceed after socket receive errors */ -enum {NO_METH = 0, GET, HEAD, PUT, POST} method = NO_METH; -const char *method_str[] = {"bug", "GET", "HEAD", "PUT", "POST"}; +enum {NO_METH = 0, GET, HEAD, PUT, POST, CUSTOM_METHOD} method = NO_METH; +const char *method_str[] = {"bug", "GET", "HEAD", "PUT", "POST", ""}; int send_body = 0; /* non-zero if sending body with request */ int requests = 1; /* Number of requests to make */ int heartbeatres = 100; /* How often do we say we're alive */ int concurrency = 1; /* Number of multiple requests to make */ int percentile = 1; /* Show percentile served */ -int nolength = 0; /* Accept variable document length */ +int nolength = 0; /* Accept variable document length */ int confidence = 1; /* Show confidence estimator and warnings */ int tlimit = 0; /* time limit in secs */ int keepalive = 0; /* try and do keepalive connections */ @@ -1950,6 +1950,7 @@ static void usage(const char *progname) 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, " -m method Method name\n"); fprintf(stderr, " -h Display usage information (this message)\n"); #ifdef USE_SSL @@ -2128,7 +2129,7 @@ int main(int argc, const char * const argv[]) myhost = NULL; /* 0.0.0.0 or :: */ apr_getopt_init(&opt, cntxt, argc, argv); - while ((status = apr_getopt(opt, "n:c:t:s:b:T:p:u:v:lrkVhwix:y:z:C:H:P:A:g:X:de:SqB:" + while ((status = apr_getopt(opt, "n:c:t:s:b:T:p:u:v:lrkVhwix:y:z:C:H:P:A:g:X:de:SqB:m:" #ifdef USE_SSL "Z:f:" #endif @@ -2301,6 +2302,10 @@ int main(int argc, const char * const argv[]) case 'Z': ssl_cipher = strdup(opt_arg); break; + case 'm': + method = CUSTOM_METHOD; + method_str[CUSTOM_METHOD] = strdup(opt_arg); + break; case 'f': if (strncasecmp(opt_arg, "ALL", 3) == 0) { meth = SSLv23_client_method(); |