views:

30

answers:

2

I have a standard web server that serve web pages.

I want to monitor traffic on port 80, intercept every http responses, and add/inject an additionnal header to them.

The process will then act like a proxy between the web server and the client.

Could you please give me some pointers? I'm already aware of SharpPCap, but I'm not sure where to start.

Note: I can't rely on the web server, I can't control it or change it's configuration. However I can install any other process on the same machine.

Thanks a million

A: 

I think what you want to do can be done with IIS 7.0 URL Rewrite module instead of rolling your own code.

http://learn.iis.net/page.aspx/711/modifying-http-response-headers/

bryanjonker
A: 

I think that SharpPCap is an overkill here.

Try:

  • listen on a port (say 8080)
  • for each incoming connection, accept and open one to the server (original one, port 80)
  • pass everything that comes in from the client straight to the server
  • pass everything that comes from the server back to the client, monitoring the stream and injecting/modifying if needed
Daniel Mošmondor
And please share if it really can work this way.
Daniel Mošmondor
Accessing the website on port 8080 is not acceptable
Pierre 303
Maybe you should reconsider, because it seems like you'll have to replicate and modify one OSI layer completely. Imagine that you have to add to a TCP packet and it is already of maximum size?
Daniel Mošmondor