httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r814805 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS docs/manual/programs/ab.xml support/ab.c
Date Mon, 14 Sep 2009 19:43:03 GMT
Author: minfrin
Date: Mon Sep 14 19:43:02 2009
New Revision: 814805

URL: http://svn.apache.org/viewvc?rev=814805&view=rev
Log:
Backport from trunk:
Add support for HTTP PUT to ab.
Submitted by: Jeff Barnes <jbarnesweb yahoo.com>

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/manual/programs/ab.xml
    httpd/httpd/branches/2.2.x/support/ab.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=814805&r1=814804&r2=814805&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Mon Sep 14 19:43:02 2009
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.14
 
+  *) Add support for HTTP PUT to ab. [Jeff Barnes <jbarnesweb yahoo.com>]
+
   *) mod_ssl: Fix SSL_*_DN_UID variables to use the 'userID' attribute
      type.  PR 45107.  [Michael Ströder <michael stroeder.com>,
      Peter Sylvester <peter.sylvester edelweb.fr>]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=814805&r1=814804&r2=814805&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Mon Sep 14 19:43:02 2009
@@ -89,12 +89,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
- * ab: Add support for HTTP PUT to ab.
-   Trunk Patch: http://svn.apache.org/viewvc?rev=811806&view=rev
-                http://svn.apache.org/viewvc?rev=811869&view=rev
-   2.2.x Patch: http://people.apache.org/~minfrin/ab.diff
-   +1: minfrin, covener, poirier
-
  * htcacheclean: 19 ways to fail, 1 error message. Fixed.
    Trunk Patch: http://svn.apache.org/viewvc?view=rev&revision=814091
    +1: covener, poirier

Modified: httpd/httpd/branches/2.2.x/docs/manual/programs/ab.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/programs/ab.xml?rev=814805&r1=814804&r2=814805&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/programs/ab.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/programs/ab.xml Mon Sep 14 19:43:02 2009
@@ -57,6 +57,7 @@
     [ -<strong>S</strong> ]
     [ -<strong>t</strong> <var>timelimit</var> ]
     [ -<strong>T</strong> <var>content-type</var> ]
+    [ -<strong>u</strong> <var>PUT-file</var> ]
     [ -<strong>v</strong> <var>verbosity</var>]
     [ -<strong>V</strong> ]
     [ -<strong>w</strong> ]
@@ -163,10 +164,13 @@
     fixed total amount of time. Per default there is no timelimit.</dd>
 
     <dt><code>-T <var>content-type</var></code></dt>
-    <dd>Content-type header to use for POST data, eg.
+    <dd>Content-type header to use for POST/PUT data, eg.
     <code>application/x-www-form-urlencoded</code>.
     Default: <code>text/plain</code>.</dd>
 
+    <dt><code>-u <var>PUT-file</var></code></dt>
+    <dd>File containing data to PUT.  Remember to also set <code>-T</code>.</dd>
+
     <dt><code>-v <var>verbosity</var></code></dt>
     <dd>Set verbosity level - <code>4</code> and above prints information
on
     headers, <code>3</code> and above prints response codes (404, 200, etc.),

Modified: httpd/httpd/branches/2.2.x/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/support/ab.c?rev=814805&r1=814804&r2=814805&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/support/ab.c (original)
+++ httpd/httpd/branches/2.2.x/support/ab.c Mon Sep 14 19:43:02 2009
@@ -763,8 +763,10 @@
     if (keepalive)
         printf("Keep-Alive requests:    %d\n", doneka);
     printf("Total transferred:      %" APR_INT64_T_FMT " bytes\n", totalread);
-    if (posting > 0)
+    if (posting == 1)
         printf("Total POSTed:           %" APR_INT64_T_FMT "\n", totalposted);
+    if (posting == 2)
+        printf("Total PUT:              %" APR_INT64_T_FMT "\n", totalposted);
     printf("HTML transferred:       %" APR_INT64_T_FMT " bytes\n", totalbread);
 
     /* avoid divide by zero */
@@ -1048,10 +1050,14 @@
     printf("<tr %s><th colspan=2 %s>Total transferred:</th>"
        "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
        trstring, tdstring, tdstring, totalread);
-    if (posting > 0)
+    if (posting == 1)
         printf("<tr %s><th colspan=2 %s>Total POSTed:</th>"
            "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
            trstring, tdstring, tdstring, totalposted);
+    if (posting == 2)
+        printf("<tr %s><th colspan=2 %s>Total PUT:</th>"
+           "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
+           trstring, tdstring, tdstring, totalposted);
     printf("<tr %s><th colspan=2 %s>HTML transferred:</th>"
        "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
        trstring, tdstring, tdstring, totalbread);
@@ -1606,12 +1612,13 @@
     }
     else {
         snprintf_res = apr_snprintf(request,  sizeof(_request),
-            "POST %s HTTP/1.0\r\n"
+            "%s %s HTTP/1.0\r\n"
             "%s" "%s" "%s"
             "Content-length: %" APR_SIZE_T_FMT "\r\n"
             "Content-type: %s\r\n"
             "%s"
             "\r\n",
+            (posting == 1) ? "POST" : "PUT",
             (isproxy) ? fullurl : path,
             keepalive ? "Connection: Keep-Alive\r\n" : "",
             cookie, auth,
@@ -1623,14 +1630,15 @@
     }
 
     if (verbosity >= 2)
-        printf("INFO: POST header == \n---\n%s\n---\n", request);
+        printf("INFO: %s header == \n---\n%s\n---\n", 
+                (posting == 2) ? "PUT" : "POST", request);
 
     reqlen = strlen(request);
 
     /*
      * Combine headers and (optional) post file into one contineous buffer
      */
-    if (posting == 1) {
+    if (posting >= 1) {
         char *buff = malloc(postlen + reqlen + 1);
         if (!buff) {
             fprintf(stderr, "error creating request buffer: out of memory\n");
@@ -1831,6 +1839,7 @@
     fprintf(stderr, "    -t timelimit    Seconds to max. wait for responses\n");
     fprintf(stderr, "    -b windowsize   Size of TCP send/receive buffer, in bytes\n");
     fprintf(stderr, "    -p postfile     File containing data to POST. Remember also to set
-T\n");
+    fprintf(stderr, "    -u putfile      File containing data to PUT. Remember also to set
-T\n");
     fprintf(stderr, "    -T content-type Content-type header for POSTing, eg.\n");
     fprintf(stderr, "                    'application/x-www-form-urlencoded'\n");
     fprintf(stderr, "                    Default is 'text/plain'\n");
@@ -2022,7 +2031,7 @@
 #endif
 
     apr_getopt_init(&opt, cntxt, argc, argv);
-    while ((status = apr_getopt(opt, "n:c:t:b:T:p:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
+    while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
 #ifdef USE_SSL
             "Z:f:"
 #endif
@@ -2047,8 +2056,8 @@
                 windowsize = atoi(optarg);
                 break;
             case 'i':
-                if (posting == 1)
-                err("Cannot mix POST and HEAD\n");
+                if (posting > 0)
+                err("Cannot mix POST/PUT and HEAD\n");
                 posting = -1;
                 break;
             case 'g':
@@ -2073,6 +2082,16 @@
                     exit(r);
                 }
                 break;
+            case 'u':
+                if (posting != 0)
+                    err("Cannot mix PUT and HEAD\n");
+                if (0 == (r = open_postfile(optarg))) {
+                    posting = 2;
+                }
+                else if (postdata) {
+                    exit(r);
+                }
+                break;
             case 'r':
                 recverrok = 1;
                 break;



Mime
View raw message