You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Rodent of Unusual Size <Ke...@Golux.Com> on 1998/01/09 23:32:29 UTC

Re: mod_log-any/1645: Tabs in CustomLog format converted to space s in log file

This is not an area that should be patched.  Whitespace in the
config file is whitespace, and gets collapsed to single spaces.
What's broken is that "\t" (among others) doesn't work in
CustomLog and LogFormat directives.

Renaud Waldura wrote:
> 
> Pinned it down!
> 
> util.c, line 551:
> 
> int
> cfg_getline(char *s, int n, FILE *f) {
>     register int i=0, c;
> 
>     s[0] = '\0';
>     /* skip leading whitespace */
>     do {
>         c = getc(f);
>     } while (c == '\t' || c == ' ');
> 
>     if(c == EOF)
>         return 1;
> 
>     while(1) {
>         if((c == '\t') || (c == ' ')) {
>             s[i++] = ' ';                               <== (*)
>             while((c == '\t') || (c == ' '))
>                 c = getc(f);
>         }
>         if(c == CR) {
>             c = getc(f);
>         }
>         if(c == EOF || c == 0x4 || c == LF || i == (n-1)) {
>             /* blast trailing whitespace */
>             while(i && (s[i-1] == ' ')) --i;
>             s[i] = '\0';
>             return 0;
>         }
>         s[i] = c;
>         ++i;
>         c = getc(f);
>     }
> }
> 
> This code doesn't know about the quoted string used by mod_log_config:
> (*) above replaces tabs & multiple spaces with one space.
> 
> I'm thinking about a patch...
> 
> --Renaud

Re: mod_log-any/1645: Tabs in CustomLog format converted to space s in log file

Posted by Ben Laurie <be...@algroup.co.uk>.
Rodent of Unusual Size wrote:
> 
> This is not an area that should be patched.  Whitespace in the
> config file is whitespace, and gets collapsed to single spaces.
> What's broken is that "\t" (among others) doesn't work in
> CustomLog and LogFormat directives.

Hmmm ... quoted whitespace should not be tampered with. Agreed that \t
et al should work, too.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: mod_log-any/1645: Tabs in CustomLog format converted to space s in log file

Posted by Paul Sutton <pa...@eu.c2.net>.
On Fri, 9 Jan 1998, Rodent of Unusual Size wrote:
> This is not an area that should be patched.  Whitespace in the
> config file is whitespace, and gets collapsed to single spaces.
> What's broken is that "\t" (among others) doesn't work in
> CustomLog and LogFormat directives.

No, I think that this is exactly the right place to fix this problem. We
shouldn't be collapsing white space within quoted strings. Unfortunately
the cfg_* reading functions are a bit of a mess -- cfg_getline() collapses
all the whitespace (ignoring quoting) then the getword functions start
spitting out words, taking account of quoting (and \-escapes). If we
update getline to know about quoting (and \-escapes) then there are two
separate bits of code essentially doing the same thing. Perhaps getline
should not collapse anything, then getword does all the
whitespace-skipping as necessary? 

//pcs