You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def response(context, flow):
flow.response.decode()
if 'Content-Type' in flow.response.headers:
if flow.response.headers['Content-Type'][0].find('javascript') != -1:
flow.response.content = processFile(flow.response.content, "js")
if flow.response.headers['Content-Type'][0].find('html') != -1:
flow.response.content = processFile(flow.response.content, "html")
You could try this:
def content_type(headers):
for key in headers.keys():
if key.lower() == "content-type":
return headers[key].lower()
return None
def response(context, flow):
flow.response.decode()
if 'javascript' in content_type(flow.response.headers):
flow.response.content = processFile(flow.response.content, "js")
elif 'html' in content_type(flow.response.headers):
flow.response.content = processFile(flow.response.content, "html")
You might want to looking at the extension of the path (i.e. filename: flow.request.path.split('/')[-1] or ext flow.request.path.split('.')[-1] -- with appropriate string sanitization)
The text was updated successfully, but these errors were encountered:
The following code in: https://github.com/Samsung/jalangi2/blob/master/scripts/proxy.py#L43
misses several files for instrumentation:
Content-Type
is case insensitive (i.e can also becontent-type
orCoNtEnT-tYpE
):http://stackoverflow.com/questions/5258977/are-http-headers-case-sensitive
You could try this:
flow.request.path.split('/')[-1]
or extflow.request.path.split('.')[-1]
-- with appropriate string sanitization)The text was updated successfully, but these errors were encountered: