I require a console app which will act as a local HTTP proxy server.
The local web browser will have its proxy settings pointed to localhost so that it uses this application for all HTTP requests. The console app should process each request and return data to the browser immediately with the following exception.
When the request is a GET and the response content type is TEXT/HTML the console app must hold onto the response as it comes in until the response is received in full. At which point the following changes must be made to the document before passing it on to the client socket of the requesting browser.
1. The opening <body> element should be located, if not present then return the document to the client socket unaltered.
2. After the opening <body> statement some javascript must be inserted which causes a "Hello world" alert to pop up.
3. The HTTP response headers must be altered appropriately (content length) to account for the inserted script - as if the additional text had originated from the server.
4. The result should then be passed onto the client socket of the browser.
Additional constraints
1. Must work with IE 7, Firefox, and Google Chrome on Windows running .NET 2.
2. Apart from the injected text the proxy should give the user the same experience as if they had gone to the server without going through the proxy - so streaming audio/video, ajax requests, etc should all still work normally.
3. The injected script must not break any javascript already in the page.
## Deliverables
1) All deliverables will be considered "work made for hire" under U.S. Copyright law. Employer will receive exclusive and complete copyrights to all work purchased. (No 3rd party components unless all copyright ramifications are explained AND AGREED TO by the employer on the site per the worker's Worker Legal Agreement).
## Platform
Windows, .NET 2