Sending HTTP headers via plain sockets

Navkirat Singh navkirats at gmail.com
Thu Jul 22 21:30:11 EDT 2010


Hi Guys,

I am very new to python and I am trying to send HTTP headers for  
redirection using sockets in python 3, but in vain. If I use the meta  
tag REFRESH method the redirection works. Please advise what I am  
missing, below is the snippet of my code:

hostsock is the socket object


print('Redirecting client')	
		hostsock.send("""HTTP/1.1 301 Moved Permanently
		Location: http://www.example.com"")


I have been up all night trying to figure this one out : ( I would be  
grateful if someone could point me in the right direction

Regards,
Nav



More information about the Python-list mailing list