On Oct 30, 2007, at 4:02 PM, Ruediger Pluem wrote:
On 10/30/2007 08:12 PM, Jim Jagielski wrote:
On Oct 22, 2007, at 9:39 AM, Jim Jagielski wrote:
The other option, of course, would be to keep the small
buffer but have some some sort of config directive that
indicates whether you want the 1st or last 64 bytes :)
That seems a nice stop-gap for 2.2
FWIW, last night I hacked up a quick little way to do
this... If conceptually OK, I'll add doccos. This is
for trunk but really designed to be the 2.2 stopgap :)
Looks good to me. IMHO copy_request could get some optimization ala:
LOL... I *just* like 5 minutes after I sent the above
did almost the exact same optimization, except I
don't set p to NULL but instead copy it and return
immediately if the_request == NULL. No need for the
strlen, etc...
if (r->the_request == NULL) {
p = "NULL";
else if (r->parsed_uri.password == NULL) {
p = r->the_request;
}
else {
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);
}
if (!ap_mod_status_reqtail) {
apr_cpystrn(rbuf, p, rbuflen);
}
else {
slen = strlen(p);
if (slen < rbuflen) {
/* it all fits anyway */
apr_cpystrn(rbuf, p, rbuflen);
}
else {
apr_cpystrn(rbuf, p+(slen-rbuflen+1), rbuflen);
}
}
Index: server/scoreboard.c
===================================================================
--- server/scoreboard.c (revision 590167)
+++ server/scoreboard.c (working copy)
@@ -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
@@ -388,6 +389,54 @@
(*new_sbh)->thread_num = thread_num;
}
+static void copy_request(char *rbuf, apr_size_t rbuflen,
request_rec *r)
+{
+ apr_size_t slen;
+
+ if (r->the_request == NULL) {
+ apr_cpystrn(rbuf, "NULL", rbuflen);
+ }
+ else if (r->parsed_uri.password == NULL) {
+ if (!ap_mod_status_reqtail) {
+ apr_cpystrn(rbuf, r->the_request, rbuflen);
+ }
+ else {
+ slen = strlen(r->the_request);
+ if (slen < rbuflen) {
+ /* it all fits anyway */
+ apr_cpystrn(rbuf, r->the_request, rbuflen);
+ }
+ else {
+ apr_cpystrn(rbuf, r->the_request+(slen-rbuflen+1),
+ rbuflen);
+ }
+ }
+ }
+ else {
+ char *p;
+ /* 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);
+ if (!ap_mod_status_reqtail) {
+ apr_cpystrn(rbuf, p, rbuflen);
+ }
+ else {
+ slen = strlen(p);
+ if (slen < rbuflen) {
+ /* it all fits anyway */
+ apr_cpystrn(rbuf, p, rbuflen);
+ }
+ else {
+ apr_cpystrn(rbuf, p+(slen-rbuflen+1), rbuflen);
+ }
+
+ }
+ }
+
+}
+
Regards
RĂ¼diger