We need to have a built the following in C#
- HTTP Proxy server
- HTTP Socket Tunnel (server+client)
Requirements and usage:
- Browser/Software (B) with proxy configured, runs on our servers and is already built.
- Proxy server (P) runs on our servers
- Http Tunnel server (TS) runs on our servers
- Http Tunnel client (TC) runs on our customers PC (behind a firewall)
- Webserver (W) the request end-point/server
- Every Http request from our servers that are configured to use the TC as a proxy should be routed via the B->P->TS->TC->W, and the HTTP response should follow the W->TC->TS->P->B path.
- The TS should keep a track of the connected TC's and ask it to lunch new sockets if needed.
- The P/TS should return a HTTP relevant error like "504 Gateway Timeout", or similar, if TC is not connected or connection is lost.
- The TC should connect to the TS using a "command/com" port.
- After the TC connects the TS should identify the unique client and, send a that will tell the TC to open a second socket, where the TC will listen for HTTP requests.
- Each TC has to be uniquely identified so the HTTP requests can be sent using the correct endpoint TC.
- Each TC should have a least one(1) socket ready that is not in use, and is just waiting for http requests to process.
- Port numbers should be configurable in bot P, TS and TC
- The P, TS and TC should be streaming sockets/proxies to speed up the requests/responses.
- It's critical/important that it is the TC that opens connections to the TS, because of firewall, subnet, public-ip issues.
- The B should use a HTTP header to identify which TC to send the request to, The TS, TC or both should remove this header before sending the request to W.
- The TC should send the HTTP requests like an anonymous proxy, meaning that the W should not be able to see any info about the HTTP request origin, except of TC.
- The P, TS and TC should work in high stress environment, with many requests passing, so threading, performance and cleanup of threads/sockets and memory is important.
We have done some research and found the following open source C# HTTP Proxy ([url removed, login to view]), we have also done a little testing to see if the project is possible, and concluded that it is possible to do.