I've got here a simple python 3 code that listens on localhost:8080.
import socket
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.bind(("127.0.0.1", 8080))
clientSocket.listen(1)
while True:
try:
(connection, address) = clientSocket.accept()
browser_request = connection.recv(99999)
print(browser_request.decode())
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverSocket.settimeout(5)
serverSocket.connect(("127.0.0.1", 1080))
serverSocket.send(browser_request)
response = serverSocket.recv(9999);
print(response.decode())
connection.send(response)
except Exception as e: print(e); pass
It gets the browser requests and redirects it on my proxy server which is listening on localhost:1080 (I use shadowsocksR proxy BTW)
"HTTP" connection works and sends data back on my browser. But when it comes to https this happens