Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Parser fails to get HTTP version for HTTP 2 protocol #22

Open
jsalort opened this issue Dec 31, 2017 · 0 comments
Open

Parser fails to get HTTP version for HTTP 2 protocol #22

jsalort opened this issue Dec 31, 2017 · 0 comments

Comments

@jsalort
Copy link

jsalort commented Dec 31, 2017

The parser works fine with HTTP/1.1 but fails with HTTP/2 that appears in Apache log with Protocols h2.

Simple example (lineB is an actual output in the Apache server log file, lineA is used to demonstrate that it works when replacing HTTP/2 by HTTP/1.1).

from apache_log_parser import make_parser
from pprint import pprint

lineA = '''137.226.113.25 - - [31/Dec/2017:03:14:19 +0100] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"'''
lineB = '''137.226.113.25 - - [31/Dec/2017:03:14:19 +0100] "GET / HTTP/2" 200 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"'''

line_parser = make_parser("%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"")

dataA = line_parser(lineA)
pprint(dataA)
dataB = line_parser(lineB)
pprint(dataB)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant