Skip to content

Commit

Permalink
Fixes #55, allow spaces in cs(Cookie) field in W3C extended logs. Inc…
Browse files Browse the repository at this point in the history
…ludes fixes to tests and removal of no longer relevant TODO.
  • Loading branch information
diosmosis committed Mar 31, 2015
1 parent 05dba48 commit 9ce7e99
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions import_logs.py
Expand Up @@ -215,6 +215,7 @@ class W3cExtendedFormat(RegexFormat):
'c-ip': '"?(?P<ip>[\d*.]*)"?',
'cs(User-Agent)': '(?P<user_agent>".*?"|\S+)',
'cs(Referer)': '(?P<referrer>\S+)',
'cs(Cookie)': '(?P<cookie>".*?"|\S+)',
'sc-status': '(?P<status>\d+)',
'sc-bytes': '(?P<length>\S+)',
'cs-host': '(?P<host>\S+)',
Expand Down
2 changes: 1 addition & 1 deletion tests/logs/iis.log
Expand Up @@ -2,4 +2,4 @@
#Version: 1.0
#Date: 2012-04-01 00:00:13
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2012-04-01 00:00:13 W3SVC834221556 PXQD1 1.2.3.4 GET /foo/bar topCat1=divinity&submit=Search 80 theuser 5.6.7.8 HTTP/1.1 Mozilla/5.0+(X11;+U;+Linux+i686;+en-US;+rv:1.9.2.7)+Gecko/20100722+Firefox/3.6.7 - - example.com 200 654 456 27028 214 1687
2012-04-01 00:00:13 W3SVC834221556 PXQD1 1.2.3.4 GET /foo/bar topCat1=divinity&submit=Search 80 theuser 5.6.7.8 HTTP/1.1 Mozilla/5.0+(X11;+U;+Linux+i686;+en-US;+rv:1.9.2.7)+Gecko/20100722+Firefox/3.6.7 "ASP.NET_SessionId=sldfkjs; __utma=21468.206199.142713.144683.183.1; utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)" - example.com 200 654 456 27028 214 1687
5 changes: 3 additions & 2 deletions tests/tests.py
Expand Up @@ -69,7 +69,7 @@ def _test_multiple_spaces(format_name, log_file = None):
if log_file is None:
log_file = 'logs/%s.log' % format_name

tmp_path = add_multiple_spaces_to_file(log_file) # TODO
tmp_path = add_multiple_spaces_to_file(log_file)

file = open(tmp_path)
import_logs.config = Config()
Expand Down Expand Up @@ -147,6 +147,7 @@ class Options(object):
regex_group_to_visit_cvars_map = {}
regex_group_to_page_cvars_map = {}
regex_groups_to_ignore = None
replay_tracking_expected_tracker_file = 'piwik.php'

class Config(object):
"""Mock configuration."""
Expand Down Expand Up @@ -312,7 +313,7 @@ def check_iis_groups(groups):

expected_hit_properties = ['date', 'path', 'query_string', 'ip', 'referrer', 'user_agent',
'status', 'length', 'host', 'userid', 'generation_time_milli',
'__win32_status']
'__win32_status', 'cookie']

for property_name in groups.keys():
assert property_name in expected_hit_properties
Expand Down

0 comments on commit 9ce7e99

Please sign in to comment.