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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sullivan WxPyQtKinter

    #1

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

    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=LAABU QLUCZIQJTZDWTFE ;
    Set-Cookie: username=testus er;
    Status:302
    Location:edit.p y
    (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?

  • Tim Roberts

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

    "Sullivan WxPyQtKinter" <sullivanz.pku@ gmail.com> wrote:[color=blue]
    >
    >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=LAABU QLUCZIQJTZDWTFE ;
    >Set-Cookie: username=testus er;
    >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?[/color]

    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=LAABU QLUCZIQJTZDWTFE ;
    Set-Cookie: username=testus er;
    Status:302
    Location:edit.p y
    """

    because you get a blank line first, which terminates the headers.
    --
    - Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    Working...