How to establish TCP connection through proxy server?
konvalo at 263.net
konvalo at 263.net
Thu Jan 17 04:05:42 EST 2002
Hello every:
I want to write a my HTTP proxy server program.But My computer is in a LAN,my IP address is 10.1.1.67.The LAN has a proxy,it's IP address is 10.1.1.105,it's port number is 3128.I listen request message from IE6.0 and transfer the message to the destination .But how can I through the proxy 10.1.1.105:3128? My step is follows:
I choose tools option of IE6.0 and choose Internet option and set LAN proxy and make proxy server address:10.1.1.67 and port:8888,then I establish TCP connection at port 8888,and accept .When I receive a request message from IE6.0 at port 8888,such as GET request,I draw the Host name from message and establish TCP connection with Host at port number 80,for example I receive message as:
GET http://www.python.org/ HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.python.org
Proxy-Connection: Keep-Alive
I found Host is www.python.org ,then I establish TCP connection at port 80:
....
import socket
HOST = 'www.python.org'
PORT = 80
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send(data)
....
How can I through proxy 10.1.1.105:3128 and establish TCP connection?
My next question is that my step of establish HTTP server is correct? Is there a better method to realize HTTP proxy server with python programming,is there python source code about proxy server? Any ideas will be appreciated.
Thanks!
Edward
__________________________________________
全场特价:数码相机、掌上电脑、MP3 http://shopping.263.net/category21.htm
天赢炒股,天生我赢! http://stock19.263.net/download/borntowin.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020117/16c12e3b/attachment.html>
More information about the Python-list
mailing list