Sending HTTP headers via plain sockets

N

Navkirat Singh

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top