trigger inline script hooks for artifical responses, fix #775

This commit is contained in:
Maximilian Hils 2015-09-18 13:51:05 +02:00
parent 5df5ee15f2
commit 66d21fa4ba

View File

@ -330,7 +330,17 @@ class HttpLayer(Layer):
if not flow.response:
self.establish_server_connection(flow)
self.get_response_from_server(flow)
else:
# response was set by an inline script.
# we now need to emulate the responseheaders hook.
flow = self.channel.ask("responseheaders", flow)
if flow == Kill:
raise Kill()
self.log("response", "debug", [repr(flow.response)])
flow = self.channel.ask("response", flow)
if flow == Kill:
raise Kill()
self.send_response_to_client(flow)
if self.check_close_connection(flow):
@ -454,15 +464,6 @@ class HttpLayer(Layer):
# we can safely set it as the final attribute value here.
flow.server_conn = self.server_conn
self.log(
"response",
"debug",
[repr(flow.response)]
)
response_reply = self.channel.ask("response", flow)
if response_reply == Kill:
raise Kill()
def process_request_hook(self, flow):
# Determine .scheme, .host and .port attributes for inline scripts.
# For absolute-form requests, they are directly given in the request.