开发者

What is the best way to add a header to all web requests sent by an application?

I'm attempting to add an HTTP header to all requests sent by a Windows application. I imagine there's some sort of way to proxy those requests to the local system, add the header, and then send them to the Internet.

Here's the thing, though. Every minute that header needs to change. So, ideally, I would write the header to a file (example: "X-Forwarded-For: 1.2.3.4"), a proxy program would read that file, add the header to all requests made through it, and send the request off to the Internet.

I've looked at Fiddler2, but I'm not familiar with its scripting language. That means I wasn't able to 开发者_如何学Cmake it read the header from the text file and add it. If anyone knows how to do this, please provide the necessary code to a) read the header from a text file and b) add that header to all requests made. Or if anyone knows an alternative program that could do this, that would be great too.

The big thing is just that the header needs to change every minute, which I haven't found an easy way to do with most programs. Thanks so much in advance; I've been working on this for hours!


What's your language of choice? If it's a .NET language, just write a very small program using FiddlerCore (http://www.fiddler2.com/core/) and it can change the value in any way you want.

As for Fiddler itself, its scripting language is just JScript.NET, so it's not complicated. How is your magic value calculated? Is there some reason you couldn't just have the script itself calculate the value?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜