Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python, implementing proxy support for a socket based application (not urllib2)

I am little stumped: I have a simple messenger client program (pure python, sockets), and I wanted to add proxy support (http/s, socks), however I am a little confused on how to go about it. I am assuming that the connection on the socket level will be done to the proxy server, at which point the headers should contain a CONNECT + destination IP (of the chat server) and authentication, (if proxy requires so), however the rest is a little beyond me. How is the subsequent connection handled, specifically the reading/writing, etc...

Are there any guides on proxy support implementation for socket based (tcp) programming in Python?

Thank you

like image 318
Terry Felkrow Avatar asked Dec 07 '25 15:12

Terry Felkrow


1 Answers

Maybe use something like SocksiPy which does all the protocol details for you and would let you connect through a SOCKS proxy as you would without it?

like image 100
Vin-G Avatar answered Dec 10 '25 03:12

Vin-G