You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2009/11/09 11:43:17 UTC

svn commit: r834013 - /httpd/httpd/trunk/modules/loggers/mod_log_config.c

Author: sf
Date: Mon Nov  9 10:43:16 2009
New Revision: 834013

URL: http://svn.apache.org/viewvc?rev=834013&view=rev
Log:
Also remove trailing whitespace in the value

Modified:
    httpd/httpd/trunk/modules/loggers/mod_log_config.c

Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=834013&r1=834012&r2=834013&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Mon Nov  9 10:43:16 2009
@@ -502,7 +502,7 @@
      * This supports Netscape version 0 cookies while being tolerant to
      * some properties of RFC2109/2965 version 1 cookies:
      * - case-insensitive match of cookie names
-     * - white space around the '='
+     * - white space between the tokens
      * It does not support the following version 1 features:
      * - quoted strings as cookie values
      * - commas to separate cookies
@@ -518,7 +518,14 @@
             apr_collapse_spaces(name, name);
 
             if (!strcasecmp(name, a) && (value = apr_strtok(NULL, "=", &last2))) {
-                value += strspn(value, " \t");  /* Move past WS */
+                char *last;
+                value += strspn(value, " \t");  /* Move past leading WS */
+                last = value + strlen(value);
+                while (last >= value && apr_isspace(*last)) {
+                   *last = '\0';
+                   --last;
+                }
+
                 return ap_escape_logitem(r->pool, value);
             }
             cookies = NULL;



Re: svn commit: r834013 - /httpd/httpd/trunk/modules/loggers/mod_log_config.c

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Monday 09 November 2009, Jeff Trawick wrote:
> > leading WS */ +                last = value + strlen(value);
> 
> doesn't this expression set last to point to the trailing '\0'
>  instead of the last character
> 
> > +                while (last >= value && apr_isspace(*last)) {
> 
> such that this loop is never entered?
> 

Thanks. Fixed.

Re: svn commit: r834013 - /httpd/httpd/trunk/modules/loggers/mod_log_config.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Nov 9, 2009 at 5:43 AM,  <sf...@apache.org> wrote:
> Author: sf
> Date: Mon Nov  9 10:43:16 2009
> New Revision: 834013
>
> URL: http://svn.apache.org/viewvc?rev=834013&view=rev
> Log:
> Also remove trailing whitespace in the value
>
> Modified:
>    httpd/httpd/trunk/modules/loggers/mod_log_config.c
>
> Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=834013&r1=834012&r2=834013&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
> +++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Mon Nov  9 10:43:16 2009
> @@ -502,7 +502,7 @@
>      * This supports Netscape version 0 cookies while being tolerant to
>      * some properties of RFC2109/2965 version 1 cookies:
>      * - case-insensitive match of cookie names
> -     * - white space around the '='
> +     * - white space between the tokens
>      * It does not support the following version 1 features:
>      * - quoted strings as cookie values
>      * - commas to separate cookies
> @@ -518,7 +518,14 @@
>             apr_collapse_spaces(name, name);
>
>             if (!strcasecmp(name, a) && (value = apr_strtok(NULL, "=", &last2))) {
> -                value += strspn(value, " \t");  /* Move past WS */
> +                char *last;
> +                value += strspn(value, " \t");  /* Move past leading WS */
> +                last = value + strlen(value);

doesn't this expression set last to point to the trailing '\0' instead
of the last character

> +                while (last >= value && apr_isspace(*last)) {

such that this loop is never entered?