This commit significantly optimizes the HTTP proxy implementation by:
1. Replacing standard http.ReadRequest with manual HTTP header parsing
- Avoids unnecessary allocations from full request parsing
- Adds 3-second timeout for initial header reading
2. Removing HttpProxyWriter abstraction
- Directly construct and send rewritten Host header
- Simplify data forwarding logic
3. Unifying WebSocket and regular HTTP handling
- Use single read loop for both cases
- Always use buffer pool for reads
4. Adding proper timeouts
- Set deadlines for header reading
- Reset timeout after headers are processed
These changes reduce memory allocations, improve performance, and simplify the proxy logic.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>