开发者

Getting request header sent by Flash

I am开发者_Python百科 not sure if this is even possible but I guess it doesn't hurt to ask.

I have a script, either through Greasemonkey or as a Chrome extension, on a page that contains a Flash application. That flash application sends out POST requests e.g. www.example.com/api/request.json?var=something.

Is it possible for the script running on that same page to capture the request header sent by the Flash code? Kind of like Tamper Data, Fiddler and the like do.

Thanks very much in advance even if the answer ends up being no :)

EDIT: Just a little more info that might help. I don't need to redirect or alter the request coming from the Flash application. I just to be able to read in the header and save that information in a variable in the user script / extension that is running on the same page.


If you really want to capture and re-route or edit that application request you can simply make an entry into your hosts file (if on windows) and run a local web server like xampp to handle the request on your machine. This is essentially completely hijacking requests to that server and you can do whatever you want with it. See this for details on how to add entries to your hosts file.

Also if you need to edit your hosts entries on another system like linux or mac, just google the same concept except add your os name next to the search. :)


With GreaseMoneky, no.

As they state in their FAQ:

Greasemonkey lets you add JavaScript code (called "user scripts") to any web page, which will run when its HTML code has loaded. [...] User scripts work more or less like bookmarklets automatically invoked for any URLs matching one or more glob patterns.

They won't be able to intercept what happens "live" as you would do with FireBug or WireShark.

They execute code when the DOM is ready and then die.

Update:

If you need to do this only to find which requests are fired, and not to intercept and/or act upon them, you can use FireBug (if you use Firefox) or Chrome's integrated development tools (press F12).


It is possible to capture HTTP POST request headers sent from Flash using chrome.experimental.webRequest extension API, but if by headers you mean the actual form data being sent, then it is not part of the headers (and cannot be captured using extension API afaik).

chrome.experimental.webRequest.onRequestSent.addListener(function(details) {
    console.log("Headers:", details);
}, null,  ["requestLine", "requestHeaders"]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜