Server is based on system epoll and non-blocking socket
All operation are non-blocking even connect is asynchronous
g++ *.cpp -g -std=c++14 -Wall -o proxy
$ ./proxy
You can test proxy server with browser and command line
-
type in the address line : about:config
-
then choose network.http.version
-
and set it to "1.0" because the proxy works with http version 1.0
-
go to about:preferences#advanced and choose tab Network
-
click on Setting and choose "Manual proxy configuration" and fill address and port of the proxy
-
All complete! Now you can see old simple site which works with HTTP 1.0
You can test proxy with curl
Just type in console:
http_proxy=PROXY_ADDRESS:PORT curl -i -0 -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://ya.ru
P.s. ya.ru for example
Or you can test it via telnet
telnet PROXY_ADDRESS PORT
And put the next request:
GET http://ya.ru/ HTTP/1.0
Host: ya.ru
User-Agent: curl/7.43.0
Proxy-Connection: Keep-Alive
Accept: application/json
Content-Type: application/json