about using httplib on apache with virtual host

charles huang fjiihyy at 21cn.com
Mon Dec 3 04:25:30 EST 2001


hi!
	I write a program to get shtml with httplib. I found that it is ok if apache do not with virtual host,but it do not work if apache with virtual host. this is my code:

import httplib,os,string,sys
fj_www = httplib.HTTP('www.fjii.com')
fj_www.putrequest('GET', '/index.shtml')
fj_www.putheader('Accept', 'text/html')
fj_www.endheaders()
#fj_www.send()
errcode, errmsg, headers = fj_www.getreply()
if (errcode!=200):
	print "it error!\n"
	sys.exit()
www_f = fj_www.getfile()
data = www_f.read() # Get the raw HTML
www_f.close()
print data

my code is error or httplib do not support virtual host?
  
            charles huang
            fjiihyy at 21cn.com





More information about the Python-list mailing list