Sending http headers with python
        Posted  
        
            by 
                Niklas R
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Niklas R
        
        
        
        Published on 2011-11-29T17:40:28Z
        Indexed on 
            2011/11/29
            17:50 UTC
        
        
        Read the original article
        Hit count: 328
        
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.
© Stack Overflow or respective owner