Python CGI problem: correct result, but incorrect browser response.

Discussion in 'Python' started by Sullivan WxPyQtKinter, Apr 6, 2006.

  1. title:python CGI problem: correct result, but incorrect browser
    response.

    In one of my CGI program,named 'login.py', the script return a HEADER
    to web browser:

    Set-Cookie: sessionID=LAABUQLUCZIQJTZDWTFE;
    Set-Cookie: username=testuser;
    Status:302
    Location:edit.py
    (blank line)

    but the IE prompted to let me choose to save the 'login.py'. When I
    save it, the file is just the header. That means the IE failed to parse
    the header. My IE has already enabled cookie read and write. I also
    tried Firefox, but the result is the same. How does this happen?
    Sullivan WxPyQtKinter, Apr 6, 2006
    #1
    1. Advertising

  2. Sullivan WxPyQtKinter

    Tim Roberts Guest

    "Sullivan WxPyQtKinter" <> wrote:
    >
    >title:python CGI problem: correct result, but incorrect browser
    >response.
    >
    >In one of my CGI program,named 'login.py', the script return a HEADER
    >to web browser:
    >
    >Set-Cookie: sessionID=LAABUQLUCZIQJTZDWTFE;
    >Set-Cookie: username=testuser;
    >Status:302
    >Location:edit.py
    >(blank line)
    >
    >but the IE prompted to let me choose to save the 'login.py'. When I
    >save it, the file is just the header. That means the IE failed to parse
    >the header. My IE has already enabled cookie read and write. I also
    >tried Firefox, but the result is the same. How does this happen?


    Perhaps you should show us the script. Is it possible that you have
    already printed a "Content-Type" header and blank line before these
    headers, or perhaps just a blank line? Remember that this will fail:

    print """
    Set-Cookie: sessionID=LAABUQLUCZIQJTZDWTFE;
    Set-Cookie: username=testuser;
    Status:302
    Location:edit.py
    """

    because you get a blank line first, which terminates the headers.
    --
    - Tim Roberts,
    Providenza & Boekelheide, Inc.
    Tim Roberts, Apr 7, 2006
    #2
    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. Replies:
    1
    Views:
    315
    bruce barker
    May 31, 2007
  2. J.Ram
    Replies:
    7
    Views:
    650
  3. Michael Tan
    Replies:
    32
    Views:
    966
    Ara.T.Howard
    Jul 21, 2005
  4. Chris Dwan
    Replies:
    4
    Views:
    154
    Nobuyoshi Nakada
    Jul 23, 2007
  5. froil
    Replies:
    12
    Views:
    310
    Gunnar Hjalmarsson
    Mar 2, 2006
Loading...

Share This Page