Sending HTTP headers via plain sockets

Discussion in 'Python' started by Navkirat Singh, Jul 23, 2010.

  1. 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
    Navkirat Singh, Jul 23, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guido Goldstein

    Re: Twisted vs POS (Plain-old sockets)

    Guido Goldstein, Sep 4, 2006, in forum: Python
    Replies:
    1
    Views:
    407
    Istvan Albert
    Sep 4, 2006
  2. Charly
    Replies:
    0
    Views:
    711
    Charly
    Aug 8, 2008
  3. Ryniek90
    Replies:
    0
    Views:
    261
    Ryniek90
    Apr 17, 2009
  4. Ian
    Replies:
    2
    Views:
    1,941
  5. Replies:
    2
    Views:
    1,216
    Michele Dondi
    May 18, 2007
Loading...

Share This Page