Sending http headers with python
- by Niklas R
I've set up a little script that should feed a client with html.
import socket
sock = socket.socket()
sock.bind(('', 8080))
sock.listen(5)
client, adress = sock.accept()
print "Incoming:", adress
print client.recv(1024)
print
client.send("Content-Type: text/html\n\n")
client.send('<html><body></body></html>')
print "Answering ..."
print "Finished."
import os
os.system("pause")
But it is shown as plain text in the browser. Can you please tell what I need to do ? I just can't find something in google that helps me..
Thanks.