You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Matus \"fantomas\" Uhlar" <uh...@fantomas.sk> on 2002/05/23 10:57:59 UTC

Log format - escape characters

Hello,

I found a little problem when trying to have query, user-agent and
http-referer in the same logfile.

All of those can have spaces, quotes and probably all characters inside.
It seems i can't find any character that would be OK as splitting
character... I tried to use quotes and I got this entry in the logfile:

1022139780 www.rolko.sk 195.91.44.84 200 5661 0 - "/" "" "https://220.0.11.254/BM-Login/?"http://www.rolko.sk/"" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)"

http referer contains quotes - I have no idea how to make sure that parsing
program/script would understand where do fields start and stop.

Any idea? I use apache 1.3.24

-- 
 Matus "fantomas" Uhlar, uhlar@fantomas.sk ; http://www.fantomas.sk/
 Warning: I don't wish to receive spam to this address.
 Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu.
    One OS to rule them all, One OS to find them, 
 One OS to bring them all and into darkness bind them 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Log format - escape characters

Posted by Matus fantomas Uhlar <uh...@fantomas.sk>.
->  -> On Thu, May 23, 2002 at 12:20:35PM +0200, Matus fantomas Uhlar wrote:
-> -> > so are all spaces and blanks quoted? is it the same about query strings?
-> -> > is the only place where can be spaces the User-Agent header?
-> -> 
-> -> I believe so, however I have never tried logging the query string as
-> -> distinct from the request URI.  If the query string is produced by removing
-> -> the '?' and all characters left of it in the request URI, then it will not
-> -> contain spaces as they must be encoded as '%20'
-> -> 
-> -> The User-Agent header is just a string and can contain many characters
-> -> beyond those allowed in URI's.
-> 
-> Ohh, I see that %U can contain space and " too... at least in 1.3.9:
-> 
-> 1022149574 test.fantomas.sk test.fantomas.sk 195.168.29.2 fw.in.nextra.sk 200 97 0 - "/a".html" "http://test.fantomas.sk/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020506"

and even in 1.3.24: 

1022150663 php.fantomas.sk 195.168.29.2 200 50 0 - "/a a.html" "" "http://php.fantomas.sk/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020506"
1022150666 php.fantomas.sk 195.168.29.2 200 50 0 - "/a"a.html" "" "http://php.fantomas.sk/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020506"

if the URL comes encoded, why not to put it encoded to log too? 

-- 
 Matus "fantomas" Uhlar, uhlar@fantomas.sk ; http://www.fantomas.sk/
 Warning: I don't wish to receive spam to this address.
 Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu.
 10 GOTO 10 : REM (C) Bill Gates 1998, All Rights Reserved!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Log format - escape characters

Posted by "Matus \"fantomas\" Uhlar" <uh...@fantomas.sk>.
 -> On Thu, May 23, 2002 at 12:20:35PM +0200, Matus fantomas Uhlar wrote:
-> > so are all spaces and blanks quoted? is it the same about query strings?
-> > is the only place where can be spaces the User-Agent header?
-> 
-> I believe so, however I have never tried logging the query string as
-> distinct from the request URI.  If the query string is produced by removing
-> the '?' and all characters left of it in the request URI, then it will not
-> contain spaces as they must be encoded as '%20'
-> 
-> The User-Agent header is just a string and can contain many characters
-> beyond those allowed in URI's.

Ohh, I see that %U can contain space and " too... at least in 1.3.9:

1022149572 test.fantomas.sk test.fantomas.sk 195.168.29.2 fw.in.nextra.sk 200 1014 0 - "/" "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020506"
1022149574 test.fantomas.sk test.fantomas.sk 195.168.29.2 fw.in.nextra.sk 200 97 0 - "/a".html" "http://test.fantomas.sk/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020506"

-- 
 Matus "fantomas" Uhlar, uhlar@fantomas.sk ; http://www.fantomas.sk/
 Warning: I don't wish to receive spam to this address.
 Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu.
 Microsoft dick is soft to do no harm

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Log format - escape characters

Posted by Zac Stevens <bu...@cryptocracy.com>.
On Thu, May 23, 2002 at 12:20:35PM +0200, Matus fantomas Uhlar wrote:
> so are all spaces and blanks quoted? is it the same about query strings?
> is the only place where can be spaces the User-Agent header?

I believe so, however I have never tried logging the query string as
distinct from the request URI.  If the query string is produced by removing
the '?' and all characters left of it in the request URI, then it will not
contain spaces as they must be encoded as '%20'

The User-Agent header is just a string and can contain many characters
beyond those allowed in URI's.

Cheers,


Zac

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Log format - escape characters

Posted by "Matus \"fantomas\" Uhlar" <uh...@fantomas.sk>.
-> On Thu, May 23, 2002 at 10:57:59AM +0200, Matus fantomas Uhlar wrote:
-> > 1022139780 www.rolko.sk 195.91.44.84 200 5661 0 - "/" "" "https://220.0.11.254/BM-Login/?"http://www.rolko.sk/"" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)"
-> > 
-> > http referer contains quotes - I have no idea how to make sure that parsing
-> > program/script would understand where do fields start and stop.
-> 
-> Don't quote the referer field - it should not contain spaces so you won't
-> have a problem with leaving it unquoted.

so are all spaces and blanks quoted? is it the same about query strings?
is the only place where can be spaces the User-Agent header?

-- 
 Matus "fantomas" Uhlar, uhlar@fantomas.sk ; http://www.fantomas.sk/
 Warning: I don't wish to receive spam to this address.
 Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu.
 Linux IS user friendly, it's just selective who its friends are...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Log format - escape characters

Posted by Zac Stevens <bu...@cryptocracy.com>.
On Thu, May 23, 2002 at 10:57:59AM +0200, Matus fantomas Uhlar wrote:
> 1022139780 www.rolko.sk 195.91.44.84 200 5661 0 - "/" "" "https://220.0.11.254/BM-Login/?"http://www.rolko.sk/"" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)"
> 
> http referer contains quotes - I have no idea how to make sure that parsing
> program/script would understand where do fields start and stop.

Don't quote the referer field - it should not contain spaces so you won't
have a problem with leaving it unquoted.

HTH,


Zac


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org