Connect to the destination protocol through HTTP Proxy
When connecting to the target server through HTTP proxy, you must first establish a connection to the proxy server. Then you need to send the connection message:
Connect <destination IP address>: <destination port> HTTP/1.1 \ r \ n
<Request Header> \ r \ n
<Request Header> \ r \ n
...
<Request Header> \ r \ n
After the message is sent, the proxy server tries to connect to the target server. If the message is successful, the message "HTTP/1.1 200..." is returned, indicating that the connection to the target server is successful. Then you can use this connection. If the returned response code is not 200, the connection fails and the proxy server closes the connection.
The returned Message format is as follows:
HTTP/1.1 <response code> <message> \ r \ n
<Response Header> \ r \ n
<Response Header> \ r \ n
...
<Response Header> \ r \ n