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. Advertisements

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. Nazgul_zulus

    sending files via HTTP

    Nazgul_zulus, Jun 24, 2004, in forum: C++
    Replies:
    1
    Views:
    491
    Thomas Matthews
    Jun 24, 2004
  2. Guido Goldstein

    Re: Twisted vs POS (Plain-old sockets)

    Guido Goldstein, Sep 4, 2006, in forum: Python
    Replies:
    1
    Views:
    490
    Istvan Albert
    Sep 4, 2006
  3. Mark Rae

    Re: Sending data Via http

    Mark Rae, Jan 11, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    424
    =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
    Feb 12, 2007
  4. Charly
    Replies:
    0
    Views:
    796
    Charly
    Aug 8, 2008
  5. Replies:
    6
    Views:
    1,420
    Justin Ezequiel
    Nov 5, 2008
  6. Ryniek90
    Replies:
    0
    Views:
    346
    Ryniek90
    Apr 17, 2009
  7. Ian
    Replies:
    2
    Views:
    2,764
  8. Replies:
    2
    Views:
    1,562
    Michele Dondi
    May 18, 2007
Loading...