mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Move Warcprox-Meta header construction to warcproxy
This commit is contained in:
parent
56f0118374
commit
ca3121102e
@ -172,8 +172,8 @@ class ProxyingRecordingHTTPResponse(http_client.HTTPResponse):
|
||||
self.msg['Via'] = via_header_value(
|
||||
self.msg.get('Via'), '%0.1f' % (self.version / 10.0))
|
||||
if extra_response_headers:
|
||||
rmeta = {"capture-metadata": extra_response_headers}
|
||||
self.msg['Warcprox-Meta'] = json.dumps(rmeta, separators=',:')
|
||||
for header, value in extra_response_headers.items():
|
||||
self.msg[header] = value
|
||||
|
||||
for k,v in self.msg.items():
|
||||
if k.lower() not in (
|
||||
|
@ -182,7 +182,8 @@ class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler):
|
||||
extra_response_headers = {}
|
||||
if warcprox_meta and 'accept' in warcprox_meta and \
|
||||
'capture-metadata' in warcprox_meta['accept']:
|
||||
extra_response_headers['timestamp'] = timestamp.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
rmeta = {'capture-metadata': {'timestamp': timestamp.strftime('%Y-%m-%dT%H:%M:%SZ')}}
|
||||
extra_response_headers['Warcprox-Meta'] = json.dumps(rmeta, separators=',:')
|
||||
|
||||
req, prox_rec_res = warcprox.mitmproxy.MitmProxyHandler._proxy_request(
|
||||
self, extra_response_headers=extra_response_headers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user