title: Python, implementing proxy support for a socket based application (not urllib2)
body: <p>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...</p>
  
  <p>Are there any guides on proxy support implementation for socket based (tcp) programming in Python?</p>
  
  <p>Thank you</p>