Re: [Zope] sending variables/parameters via hyperlink
Horatio B. Bogbindero writes:
... <a href="newpage.htm?variablename=value">Sent value to newpage.htm</a>
i get this error:
--------error start---------o Error response
Error code 400.
Message: Bad Request. This should work *IF* the URL does not contain funny characters.
Note that many characters are not allowed in URL's and especially "value" above must not contain blanks (as per HTML 4.x and CGI). Such values must be quoted with "url_quote_plus". Dieter
Dieter Maurer wrote:
This should work *IF* the URL does not contain funny characters.
Note that many characters are not allowed in URL's and especially "value" above must not contain blanks (as per HTML 4.x and CGI). Such values must be quoted with "url_quote_plus".
Why is it so bad if values contain spaces? This is the same area as why variables supplied without a value, eg: http://server/method?paramater ...don't end up in the namespace, eg, from the above example: REQUEST['paramater']=None cheers, Chris
Chris Withers writes:
Dieter Maurer wrote:
This should work *IF* the URL does not contain funny characters.
Note that many characters are not allowed in URL's and especially "value" above must not contain blanks (as per HTML 4.x and CGI). Such values must be quoted with "url_quote_plus".
Why is it so bad if values contain spaces? I think, it was because in early days most CGI scripts were shell scripts. It is quite hard to pass values into shell scripts that contain blanks. Unix shells are very keen to reparse them and break them up at whitespace into a sequence of words.
Anyway, when you look at the current HTTP (4.01) specification, you can read that space has to be replaced by '+'. To be precise, this is a requirement for the "application/x-www-form-urlencoded" content type.
This is the same area as why variables supplied without a value, eg: http://server/method?paramater
....don't end up in the namespace, eg, from the above example: When I looked at "ZPublisher.cgi", I had the impression that it treats such constructs as "values" rather than "names" and associate all of them with 'None'. If I am right, then ZPublisher does not expose such items.
I did not check the CGI spec to learn what is the correct behaviour. Dieter
participants (2)
-
Chris Withers -
Dieter Maurer