I have the following definition in .htaccess:
RewriteRule ^browse/(.*)
http://127.0.0.1:8007/kt/default/browse/$1
[P]
Should be trivial, but i think spaces in url are not encoded right
way.
Im requesting
http://127.0.0.1:8007/kt/default/browse/this is a test
or
http://127.0.0.1:8007/kt/default/browse/this%20is%20a%20test
and i get:
http://127.0.0.1:8007/kt/default/browse/this is a test
When reading specs
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
SP suppose to mean SPACE, so i think url should have space characters
already converted to %20. But the problem here is, that when i was
testing with safari and firefox, safari handled all spaces by putting
%20 automatic on urls, while firefox changed all %20 to empty spaces,
which caused problem on wsgiserver.py. And that happened only if i
used
mod_rewrite [P].
Error is:
Traceback (most recent call last):
File "/***/web2py/gluon/wsgiserver.py", line 762, in communicate
req.parse_request()
File "/***/web2py/gluon/wsgiserver.py", line 258, in parse_request
self._parse_request()
File "/***/web2py/gluon/wsgiserver.py", line 334, in _parse_request
rp = int(req_protocol[5]), int(req_protocol[7])
ValueError: invalid literal for int() with base 10: 't'
and is easily corrected by changing line in wsgiserver.py:
#method, path, req_protocol = request_line.strip().split(" ", 2)
_reg = request_line.strip().split(" ")
method, path, req_protocol = [_reg[0], " ".join(_reg[1:-1]), _reg[-1]]
So how this should be, which part of the system is responsible of
encoding and decoding spaces?
My configuration is Apache2 with mod_proxy + mod_rewrite + Python 2.5
on
Debian etch, web2py 1.49 as a web framework.
Regards,
Marko