Skip to content

Commit

Permalink
fix for issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
noeltimothy committed Jan 2, 2024
1 parent fa32608 commit 9c3a1c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/ja4h.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ def http_language(lang):

def to_ja4h(x, debug_stream=-1):
cookie = 'c' if 'cookies' in x else 'n'
referer = 'r' if 'referer' in x['headers'] else 'n'
referer = 'r' if 'referer' in x['headers'] or 'Referer' in x['headers'] else 'n'
method = http_method(x['method'])
version = 11 if x['hl'] == 'http' else 20
unsorted_cookie_fields = []
unsorted_cookie_values = []

x['headers'] = [ h.split(':')[0] for h in x['headers'] ]
x['headers'] = [ h for h in x['headers'] if not h.startswith(':') and not h.startswith('cookie') and h != 'referer' and h ]
x['headers'] = [ h for h in x['headers']
if not h.startswith(':') and not (h.startswith('cookie') or h.startswith('Cookie'))
and (h != 'referer' or h!= 'Referer') and h ]

raw_headers = x['headers'][:]

Expand Down

0 comments on commit 9c3a1c2

Please sign in to comment.