You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ch...@apache.org on 2012/07/17 17:26:27 UTC

svn commit: r1362538 - in /httpd/httpd/trunk: CHANGES server/util_script.c

Author: chrisd
Date: Tue Jul 17 15:26:27 2012
New Revision: 1362538

URL: http://svn.apache.org/viewvc?rev=1362538&view=rev
Log:
Log the value of Status header lines in script responses rather than
than just the fixed header name of "Status".

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/util_script.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1362538&r1=1362537&r2=1362538&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jul 17 15:26:27 2012
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: Log value of Status header line in script responses rather
+     than the fixed header name.  [Chris Darroch]
+
   *) mpm_event: Don't count connections in lingering close state when
      calculating how many additional connections may be accepted.
      [Stefan Fritsch]

Modified: httpd/httpd/trunk/server/util_script.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1362538&r1=1362537&r2=1362538&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_script.c (original)
+++ httpd/httpd/trunk/server/util_script.c Tue Jul 17 15:26:27 2012
@@ -592,11 +592,11 @@ AP_DECLARE(int) ap_scan_script_header_er
             if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
                 ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
                               "Invalid status line from script '%s': %s",
-                              apr_filepath_name_get(r->filename), w);
+                              apr_filepath_name_get(r->filename), l);
             else
                 ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r,
                               "Status line from script '%s': %s",
-                              apr_filepath_name_get(r->filename), w);
+                              apr_filepath_name_get(r->filename), l);
             r->status_line = apr_pstrdup(r->pool, l);
         }
         else if (!strcasecmp(w, "Location")) {



Re: svn commit: r1362538 - in /httpd/httpd/trunk: CHANGES server/util_script.c

Posted by Chris Darroch <ch...@pearsoncmg.com>.
Jeff Trawick wrote:

>>> what about limiting the number of characters logged and potentially
>>> sent to the client via error-notes?
>>>
>>> ("%.120s" anyone?)
>>
>>   Sounds good to me ... are there any debug/trace log which truncate
>> output in a similar way that could serve as "best practices" examples?
>> I fished around a bit for %.[0-9]+s but didn't see anything obvious ...
> 
> dunno
> 
> Actually, I wonder why this code allows the unexpected script output
> to be part of error-notes anyway.  In fact all the uses of
> APLOG_TOCLIENT look suspect.  Why should the client be told anything
> about the application that handles the request?  The feature
> presumably helps CGI developers, but they should be able to check the
> error log.

   OK, back from vacation ... I didn't see any other followups on this
so I'll likely just go with your original suggestion and add the string
limit of some modest length like 120 chars.  Sound OK?

Chris.

-- 
GPG Key ID: 088335A9
GPG Key Fingerprint: 86CD 3297 7493 75BC F820  6715 F54F E648 0883 35A9


Re: svn commit: r1362538 - in /httpd/httpd/trunk: CHANGES server/util_script.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, Jul 19, 2012 at 12:56 PM, Chris Darroch <ch...@pearsoncmg.com> wrote:
> Jeff Trawick wrote:
>
>>> Modified: httpd/httpd/trunk/server/util_script.c
>>> URL:
>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1362538&r1=1362537&r2=1362538&view=diff
>>>
>>> ==============================================================================
>>> --- httpd/httpd/trunk/server/util_script.c (original)
>>> +++ httpd/httpd/trunk/server/util_script.c Tue Jul 17 15:26:27 2012
>>> @@ -592,11 +592,11 @@ AP_DECLARE(int) ap_scan_script_header_er
>>>              if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
>>>                  ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT,
>>> 0, r,
>>>                                "Invalid status line from script '%s':
>>> %s",
>>
>>
>> what about limiting the number of characters logged and potentially
>> sent to the client via error-notes?
>>
>> ("%.120s" anyone?)
>
>
>   Sounds good to me ... are there any debug/trace log which truncate
> output in a similar way that could serve as "best practices" examples?
> I fished around a bit for %.[0-9]+s but didn't see anything obvious ...

dunno

Actually, I wonder why this code allows the unexpected script output
to be part of error-notes anyway.  In fact all the uses of
APLOG_TOCLIENT look suspect.  Why should the client be told anything
about the application that handles the request?  The feature
presumably helps CGI developers, but they should be able to check the
error log.

>
> Chris.
>
> --
> GPG Key ID: 088335A9
> GPG Key Fingerprint: 86CD 3297 7493 75BC F820  6715 F54F E648 0883 35A9
>



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: svn commit: r1362538 - in /httpd/httpd/trunk: CHANGES server/util_script.c

Posted by Chris Darroch <ch...@pearsoncmg.com>.
Jeff Trawick wrote:

>> Modified: httpd/httpd/trunk/server/util_script.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1362538&r1=1362537&r2=1362538&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/server/util_script.c (original)
>> +++ httpd/httpd/trunk/server/util_script.c Tue Jul 17 15:26:27 2012
>> @@ -592,11 +592,11 @@ AP_DECLARE(int) ap_scan_script_header_er
>>              if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
>>                  ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
>>                                "Invalid status line from script '%s': %s",
> 
> what about limiting the number of characters logged and potentially
> sent to the client via error-notes?
> 
> ("%.120s" anyone?)

   Sounds good to me ... are there any debug/trace log which truncate
output in a similar way that could serve as "best practices" examples?
I fished around a bit for %.[0-9]+s but didn't see anything obvious ...

Chris.

-- 
GPG Key ID: 088335A9
GPG Key Fingerprint: 86CD 3297 7493 75BC F820  6715 F54F E648 0883 35A9


Re: svn commit: r1362538 - in /httpd/httpd/trunk: CHANGES server/util_script.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Tue, Jul 17, 2012 at 11:26 AM,  <ch...@apache.org> wrote:
> Author: chrisd
> Date: Tue Jul 17 15:26:27 2012
> New Revision: 1362538
>
> URL: http://svn.apache.org/viewvc?rev=1362538&view=rev
> Log:
> Log the value of Status header lines in script responses rather than
> than just the fixed header name of "Status".
>
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/server/util_script.c
>
> Modified: httpd/httpd/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1362538&r1=1362537&r2=1362538&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jul 17 15:26:27 2012
> @@ -1,6 +1,9 @@
>                                                           -*- coding: utf-8 -*-
>  Changes with Apache 2.5.0
>
> +  *) core: Log value of Status header line in script responses rather
> +     than the fixed header name.  [Chris Darroch]
> +
>    *) mpm_event: Don't count connections in lingering close state when
>       calculating how many additional connections may be accepted.
>       [Stefan Fritsch]
>
> Modified: httpd/httpd/trunk/server/util_script.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1362538&r1=1362537&r2=1362538&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/util_script.c (original)
> +++ httpd/httpd/trunk/server/util_script.c Tue Jul 17 15:26:27 2012
> @@ -592,11 +592,11 @@ AP_DECLARE(int) ap_scan_script_header_er
>              if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
>                  ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
>                                "Invalid status line from script '%s': %s",

what about limiting the number of characters logged and potentially
sent to the client via error-notes?

("%.120s" anyone?)

> -                              apr_filepath_name_get(r->filename), w);
> +                              apr_filepath_name_get(r->filename), l);
>              else
>                  ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r,
>                                "Status line from script '%s': %s",
> -                              apr_filepath_name_get(r->filename), w);
> +                              apr_filepath_name_get(r->filename), l);
>              r->status_line = apr_pstrdup(r->pool, l);
>          }
>          else if (!strcasecmp(w, "Location")) {
>
>



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/