Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%{Cookie} can contain \" and should be ignored #1

Open
julester23 opened this issue Mar 31, 2011 · 2 comments
Open

%{Cookie} can contain \" and should be ignored #1

julester23 opened this issue Mar 31, 2011 · 2 comments

Comments

@julester23
Copy link

What steps will reproduce the problem?

  1. Add a %{Cookie} to your CustomLog
  2. Have a cookie with quotation marks
  3. Try to use apachelog to parse the lines

Easiest fix:
Change findreferreragent = re.compile('Referer|User-Agent', re.I) to findreferreragent = re.compile('Referer|User-Agent|Cookie', re.I)

What is the expected output?
A parse-able line
What do you see instead?
Unparsable line

Please provide any additional information below.
Here's an example CustomLog line:
127.0.0.1 - - [31/Mar/2011:11:35:40 -0700] "GET /events HTTP/1.1" 200 103324 "https://blah.com/core" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4" 11339 blah.com 80 6082970 "tokens=blah; otherstuff=blerg; badstuff="hey look at my quotation marks""

here's a test for you:

def testline5(self):
    data = self.x.parse(self.line5)
    self.assertEqual(data['%h'], '127.0.0.1', msg = 'Line 5 %h')
    self.assertEqual(data['%V'], 'blah.com', msg = 'Line 5 %V')
    self.assertEqual(data['%{Cookie}i'], 'tokens=blah; otherstuff=blerg; badstuff=\\"hey look at my quotation marks\\"', msg = 'Line 5 %{Cookie}i')
@leopku
Copy link
Owner

leopku commented Apr 16, 2011

thanks a lot!

Repository owner deleted a comment Feb 2, 2024
@luo0412
Copy link

luo0412 commented Feb 21, 2024 via email

Repository owner deleted a comment from leggod Feb 21, 2024
Repository owner deleted a comment from BhavyClover Feb 22, 2024
Repository owner deleted a comment from sxnkr Feb 23, 2024
Repository owner deleted a comment from tim-tepia Mar 18, 2024
Repository owner deleted a comment from manish7017 Mar 19, 2024
@github-staff github-staff deleted a comment from naudachu May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@leopku @julester23 @luo0412 and others