Retrieving a query string from a <FORM ACTION> command

Andre van Straaten andre at UltraShell.Net
Mon Jul 31 19:46:38 EDT 2000


What I don't understand is how the Web form (or the browser) did send spaces to the server.
URI encoding translates spaces into +'s, I think, because an RFC determines that.
This applies to both methods.
I'm pretty sure that some C/C++ functions would stop reading from stdin, using the POST method, if
spaces were in the datastream sent to the server.
Did you (or others) change the browser or its configuration?
If yes, it would be interesting to know what it was because this is something that shouldn't
happen.

-- avs
 
Paul Goodyear <paul at gudge.demon.co.uk> wrote:
> Yep i'm a newbie here.

> Been doing this stuff for about a month and it rocks. The thing is I wrote a
> guestbook and for the last weeks it's been working fine. But all of a sudden
> the text that is sent to my server from the web page in the comments text
> input or textarea boxes are sent with +'s instead of spaces.

> I have tried both action="get" and action="post" in the HTML code.

> I have put the code below that does the grabbing:

> HTML CODE:
> ---------------

> <form method="get" action="/cgi-bin/guestbook.py">


> PYTHON CODE:
> -------------------

>     import time, string, os

>     print "Content-type: text/html\n\n"

>     qs = os.environ['QUERY_STRING']
>     t = string.split(qs, "?")
>     tt = string.split(t[0], '&')
>     NameString = string.split(tt[0], '=')
>     EmailString = string.split(tt[1], '=')
>     CommentString = string.split(tt[2], '=');

>     TimeString = time.ctime(time.time())

>     GuestList = open('cgi-bin/guestbook.txt')
>     CurrentGuest = GuestList.readlines()
>     GuestList.close()


>     GuestList = open('cgi-bin/guestbook.txt', 'w')
>     line = NameString[1] + ',' + EmailString[1] + ',' + CommentString[1] +
> ',' + TimeString + '\n'
>     GuestList.write(line)
>     GuestList.writelines(CurrentGuest)
>     GuestList.close()

> I'm taking the query string and placing all the fields into variables,
> reading in the current entries and then writing them all out again.

> But as I said and why I need help is that all the spaces are now been
> replaced with + sysbols, which can I stress didn't do at first. I have
> changed the code and put it back and it did just the same.

> Please help.

> email or post.



-- 

Andre van Straaten
http://www.vanstraatensoft.com
______________________________________________
flames please to /dev/null at vanstraatensoft.com




More information about the Python-list mailing list