You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2007/12/08 17:59:09 UTC

svn commit: r602508 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS docs/manual/mod/mod_status.xml include/ap_mmn.h include/scoreboard.h modules/generators/mod_status.c server/scoreboard.c

Author: rpluem
Date: Sat Dec  8 08:59:08 2007
New Revision: 602508

URL: http://svn.apache.org/viewvc?rev=602508&view=rev
Log:
Merge 590641 from trunk:

Add in SeeRequestTail directive, to handle the shortcoming
of only storing 63 bytes of the request, when the requests
are longer than that and only vary towards the end; eg:

   GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/apples.jpg
   GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/pears.jpg
   GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/plums.jpg

Submitted by: jim
Reviewed by: jim, rpluem, niq

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/manual/mod/mod_status.xml
    httpd/httpd/branches/2.2.x/include/ap_mmn.h
    httpd/httpd/branches/2.2.x/include/scoreboard.h
    httpd/httpd/branches/2.2.x/modules/generators/mod_status.c
    httpd/httpd/branches/2.2.x/server/scoreboard.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Dec  8 08:59:08 2007
@@ -36,6 +36,12 @@
      don't escape/unescape forward-proxied URLs.
      PR 41798, 42592 [Nick Kew, Ruediger Pluem, Roy Fielding, Jim Jagielski]
 
+  *) mod_status: Add SeeRequestTail directive, which determines if
+     ExtendedStatus displays the 1st 63 characters of the request
+     or the last 63. Useful for those requests with large string
+     lengths and which only vary with the last several characters.
+     [Jim Jagielski]
+
   *) mod_ssl: Prevent memory corruption of version string.
      PR 43865, 43334 [William Rowe, Joe Orton]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Dec  8 08:59:08 2007
@@ -79,15 +79,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_status: For long request lines we only see the front part of
-    the requests in mod_status, which is useless if they only vary
-    in their ending bits. Allow admin to specify whether they want
-    to see the 1st 63 chars of the request, or the last.
-    trunk:
-       http://svn.apache.org/viewvc?view=rev&revision=590641
-    2.2.x:
-       http://people.apache.org/~jim/patches/reqtail-patch.txt
-    +1: jim, rpluem, niq
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_status.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_status.xml?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_status.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_status.xml Sat Dec  8 08:59:08 2007
@@ -140,5 +140,29 @@
 </usage>
 
 </directivesynopsis>
+<directivesynopsis>
+
+<name>SeeRequestTail</name>
+<description>Determine if mod_status displays the first 63 characters
+of a request or the last 63, assuming the request itself is greater than
+63 chars.</description>
+<syntax>SeeRequestTail On|Off</syntax>
+<default>SeeRequestTail Off</default>
+<contextlist><context>server config</context></contextlist>
+<compatibility>SeeRequestTail is only available in Apache 2.2.7 and 
+later.</compatibility>
+
+<usage>
+    <p>mod_status with ExtendedStatus On displays the actual request being
+    handled. For historical purposes, only 63 characters of the request
+    are actually stored for display purposes. This directive
+    controls whether the 1st 63 characters are stored (the previous
+    behavior and the default) or if the last 63 characters are. This
+    is only applicable, of course, if the length of the request is
+    64 characters or greater.</p>
+</usage>
+
+</directivesynopsis>
+
 </modulesynopsis>
 

Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Sat Dec  8 08:59:08 2007
@@ -118,6 +118,7 @@
  * 20051115.7 (2.2.7)  Added conn_rec::clogging_input_filters (minor)
  * 20051115.8 (2.2.7)  Added flags to proxy_alias (minor)
  * 20051115.9 (2.2.7)  Add ap_send_interim_response API
+ * 20051115.10(2.2.7)  Added ap_mod_status_reqtail (minor)
  *
  */
 
@@ -126,7 +127,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 9                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 10                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/branches/2.2.x/include/scoreboard.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/scoreboard.h?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/scoreboard.h (original)
+++ httpd/httpd/branches/2.2.x/include/scoreboard.h Sat Dec  8 08:59:08 2007
@@ -197,6 +197,7 @@
 AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image;
 AP_DECLARE_DATA extern const char *ap_scoreboard_fname;
 AP_DECLARE_DATA extern int ap_extended_status;
+AP_DECLARE_DATA extern int ap_mod_status_reqtail;
 
 AP_DECLARE_DATA extern ap_generation_t volatile ap_my_generation;
 

Modified: httpd/httpd/branches/2.2.x/modules/generators/mod_status.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/generators/mod_status.c?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/generators/mod_status.c (original)
+++ httpd/httpd/branches/2.2.x/modules/generators/mod_status.c Sat Dec  8 08:59:08 2007
@@ -128,10 +128,24 @@
     return NULL;
 }
 
+static const char *set_reqtail(cmd_parms *cmd, void *dummy, int arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+    ap_mod_status_reqtail = arg;
+    return NULL;
+}
+
+
 static const command_rec status_module_cmds[] =
 {
     AP_INIT_FLAG("ExtendedStatus", set_extended_status, NULL, RSRC_CONF,
       "\"On\" to enable extended status information, \"Off\" to disable"),
+    AP_INIT_FLAG("SeeRequestTail", set_reqtail, NULL, RSRC_CONF,
+      "For verbose requests, \"On\" to see the last 63 chars of the request, "
+      "\"Off\" (default) to see the first 63 in extended status display"),
     {NULL}
 };
 

Modified: httpd/httpd/branches/2.2.x/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/scoreboard.c?rev=602508&r1=602507&r2=602508&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/scoreboard.c (original)
+++ httpd/httpd/branches/2.2.x/server/scoreboard.c Sat Dec  8 08:59:08 2007
@@ -40,6 +40,7 @@
 AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL;
 AP_DECLARE_DATA const char *ap_scoreboard_fname = NULL;
 AP_DECLARE_DATA int ap_extended_status = 0;
+AP_DECLARE_DATA int ap_mod_status_reqtail = 0;
 
 #if APR_HAS_SHARED_MEMORY
 
@@ -380,6 +381,42 @@
     (*new_sbh)->thread_num = thread_num;
 }
 
+static void copy_request(char *rbuf, apr_size_t rbuflen, request_rec *r)
+{
+    char *p;
+
+    if (r->the_request == NULL) {
+        apr_cpystrn(rbuf, "NULL", rbuflen);
+        return; /* short circuit below */
+    }
+
+    if (r->parsed_uri.password == NULL) {
+        p = r->the_request;
+    }
+    else {
+        /* Don't reveal the password in the server-status view */
+        p = apr_pstrcat(r->pool, r->method, " ",
+                        apr_uri_unparse(r->pool, &r->parsed_uri,
+                        APR_URI_UNP_OMITPASSWORD),
+                        r->assbackwards ? NULL : " ", r->protocol, NULL);
+    }
+
+    /* now figure out if we copy over the 1st rbuflen chars or the last */
+    if (!ap_mod_status_reqtail) {
+        apr_cpystrn(rbuf, p, rbuflen);
+    }
+    else {
+        apr_size_t slen = strlen(p);
+        if (slen < rbuflen) {
+            /* it all fits anyway */
+            apr_cpystrn(rbuf, p, rbuflen);
+        }
+        else {
+            apr_cpystrn(rbuf, p+(slen-rbuflen+1), rbuflen);
+        }
+    }
+}
+
 AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
                                                     int thread_num,
                                                     int status,
@@ -422,18 +459,7 @@
             conn_rec *c = r->connection;
             apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config,
                         REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
-            if (r->the_request == NULL) {
-                apr_cpystrn(ws->request, "NULL", sizeof(ws->request));
-            } else if (r->parsed_uri.password == NULL) {
-                apr_cpystrn(ws->request, r->the_request, sizeof(ws->request));
-            } else {
-                /* Don't reveal the password in the server-status view */
-                apr_cpystrn(ws->request, apr_pstrcat(r->pool, r->method, " ",
-                            apr_uri_unparse(r->pool, &r->parsed_uri,
-                            APR_URI_UNP_OMITPASSWORD),
-                            r->assbackwards ? NULL : " ", r->protocol, NULL),
-                            sizeof(ws->request));
-            }
+            copy_request(ws->request, sizeof(ws->request), r);
             apr_cpystrn(ws->vhost, r->server->server_hostname,
                         sizeof(ws->vhost));
         }