mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-01-04 07:03:44 +01:00
Change header labels to all lowercase.
This commit is contained in:
parent
24d02895ef
commit
2c504ae67e
2 changed files with 4 additions and 4 deletions
|
|
@ -100,7 +100,7 @@ class FirefoxCache2(BaseBrowserCache):
|
|||
# redirect when Location header
|
||||
headers = metadata.get('response-headers',{})
|
||||
## seen both Location and location
|
||||
location = headers.get('Location', headers.get('location',''))
|
||||
location = headers.get('location','')
|
||||
entry_file.seek(0)
|
||||
rawdata = None if location else entry_file.read(metadata['readsize'])
|
||||
return (
|
||||
|
|
@ -181,7 +181,7 @@ def _read_entry_headers(entry_file):
|
|||
# else:
|
||||
# logger.debug("Status:(no response-head)")
|
||||
if 'original-response-headers' in moremetadict:
|
||||
retval['response-headers'] = dict([ x.split(': ',1) for x in moremetadict['original-response-headers'].split('\r\n') if x ])
|
||||
retval['response-headers'] = dict([ (y[0].lower(),y[1]) for y in [ x.split(': ',1) for x in moremetadict['original-response-headers'].split('\r\n') if x ]])
|
||||
# logger.debug(b"\n==>".join().decode('utf-8'))
|
||||
|
||||
if 'alt-data' in moremetadict:
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class SimpleCache(BaseChromiumCache):
|
|||
# logger.debug("Creation Time: %s"%datetime.datetime.fromtimestamp(int(response_time/1000000)-EPOCH_DIFFERENCE))
|
||||
logger.debug(headers)
|
||||
## seen both Location and location
|
||||
location = headers.get('Location', headers.get('location',''))
|
||||
location = headers.get('location','')
|
||||
# don't need data when redirect
|
||||
rawdata = None if location else _read_data_from_entry(entry_file)
|
||||
return (
|
||||
|
|
@ -231,7 +231,7 @@ def _read_headers(entry_file,header_size):
|
|||
# It is a series of null terminated strings, first is status code,e.g., "HTTP/1.1 200"
|
||||
# the rest are name:value pairs used to populate the headers dict.
|
||||
strings = entry_file.read(header_size).decode('utf-8').split('\0')
|
||||
headers = dict(s.split(':', 1) for s in strings[1:] if ':' in s)
|
||||
headers = dict([ (y[0].lower(),y[1]) for y in [s.split(':', 1) for s in strings[1:] if ':' in s]])
|
||||
return headers
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue