Location: and location: headers both used...

This commit is contained in:
Jim Miller 2022-12-17 13:50:23 -06:00
parent ccd25b0c93
commit f613fea791
3 changed files with 9 additions and 3 deletions

View file

@ -119,7 +119,7 @@ class BlockfileCache(BaseChromiumCache):
logger.debug("Creation Time: %s"%entry.creationTime)
# logger.debug("Creation Time: %s"%datetime.datetime.fromtimestamp(int(entry.creationTime/1000000)-EPOCH_DIFFERENCE))
logger.debug("Key: %s"%entry.keyToStr())
logger.debug(entry.httpHeader.headers.get(b'location','(no location)'))
logger.debug("b'location':%s"%entry.httpHeader.headers.get(b'location','(no location)'))
if entry_name == key:
location = ensure_text(entry.httpHeader.headers.get(b'location',''))
ensure_text(entry.httpHeader.headers.get(b'content-encoding',''))

View file

@ -91,8 +91,13 @@ class FirefoxCache2(BaseBrowserCache):
if os.path.isfile(key_path): # share_open()'s failure for non-existent is some win error.
with share_open(key_path, "rb") as entry_file:
metadata = _read_entry_headers(entry_file)
import json
logger.debug(json.dumps(metadata, sort_keys=True,
indent=2, separators=(',', ':')))
# redirect when Location header
location = metadata.get('response-headers',{}).get('Location', '')
headers = metadata.get('response-headers',{})
## seen both Location and location
location = headers.get('Location', headers.get('location',''))
entry_file.seek(0)
rawdata = None if location else entry_file.read(metadata['readsize'])
return (

View file

@ -126,7 +126,8 @@ class SimpleCache(BaseChromiumCache):
logger.debug("response_time:%s"%response_time)
# logger.debug("Creation Time: %s"%datetime.datetime.fromtimestamp(int(response_time/1000000)-EPOCH_DIFFERENCE))
logger.debug(headers)
location = headers.get('Location', '')
## seen both Location and location
location = headers.get('Location', headers.get('location',''))
# don't need data when redirect
rawdata = None if location else _read_data_from_entry(entry_file)
return (