Looking for some help to log HTTP requests for a given page.
Essentially I'm looking at running a Ubuntu instance to log HTTP requests from a given page and parse them out to the user. I'd like to use a Python Web App client side.
Workflow is :
User types in URL > App takes in Requests > XULRunner "does something" > Python App returns cookies set for the given URL.
Looking for some pointers around the process "XULRunner does something"?
You probably want to use a <browser type="content">
tag in XULRunner and use browser.addProgressListener()
to add a web progress listener. With the progress listener you will be able to track all requests (calls to onStateChange
with aFlag
containing STATE_IS_REQUEST
flag). The progress listener can then read out the requested address (aRequest.QueryInterface(Components.interfaces.nsIChannel).URI.spec
) and log it. If aFlag
contains STATE_STOP
flag then you can also read out response headers (aRequest.QueryInterface(Components.interfaces.nsIHttpChannel).getResponseHeader("Set-Cookie")
). Calling browser.loadURI()
actually starts loading the page.