<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hello every:</FONT></DIV>
<DIV><FONT size=2>   I want to write a my HTTP proxy server 
program.But My computer is in </FONT><FONT size=2>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:</FONT></DIV>
<DIV><FONT size=2>   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:</FONT></DIV>
<DIV><FONT size=2> </FONT></DIV>
<DIV><FONT size=2>  GET <A 
href="http://www.python.org/">http://www.python.org/</A> HTTP/1.0<BR>  
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*<BR>  
Accept-Language: zh-cn<BR>  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; 
Windows NT 5.0)<BR>  Host: <A 
href="http://www.python.org">www.python.org</A><BR>  Proxy-Connection: 
Keep-Alive</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I found Host is <A 
href="http://www.python.org">www.python.org</A> ,then I establish TCP connection 
at port 80:</FONT></DIV>
<DIV><FONT size=2>  .... </FONT></DIV>
<DIV><FONT size=2>  import socket<BR>  HOST = 
'www.python.org'  </FONT></DIV>
<DIV><FONT size=2>  PORT = 
80              
</FONT></DIV>
<DIV><FONT size=2>  s = socket.socket(socket.AF_INET, 
socket.SOCK_STREAM)<BR>  s.connect((HOST, PORT))<BR>  
s.send(data)</FONT></DIV>
<DIV><FONT size=2>  ....</FONT></DIV>
<DIV><FONT size=2>How can I through proxy 10.1.1.105:3128 and establish TCP 
connection?</FONT></DIV>
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=2>Thanks!</FONT></DIV>
<DIV><FONT size=2>Edward</FONT></DIV>
<DIV><FONT size=2><BR>  `<BR></DIV></FONT>
<DIV><FONT size=2></FONT> </DIV></BODY></HTML>