durusmail: quixote-users: (Not) stripped URL fragment - solved
(Not) stripped URL fragment - solved
2003-08-06
2003-09-03
2003-09-03
2003-09-04
(Not) stripped URL fragment - solved
Neil Schemenauer
2003-09-03
On Wed, Aug 06, 2003 at 05:41:17PM +0400, Oleg Broytmann wrote:
>    I found that the problem is between Medusa and Quixote: QuixoteHandler
> incorrectly parses request.uri.
>    The patch to solve this is attached. I tested the patch on Linux and
> Windows, Python 2.2 and 2.3, browsers Mozilla and M$IE.
>
>    I am not sure what to with "params". I have never used this style of
> parameters. May be I should append them to path? to query_string?

I'm pretty sure they shouldn't be part of the query_string but I don't
know where else they should go.  I've never seen them used before
either.

> !                    'REQUEST_URI':path,

I don't think this is right.  Shouldn't it be:

                       'REQUEST_URI': request.uri,

I've attached a patch if someone wants to test.

  Neil


Index: medusa_http.py
===================================================================
--- medusa_http.py      (revision 22369)
+++ medusa_http.py      (working copy)
@@ -56,9 +56,9 @@
     def continue_request (self, data, request):
         msg = rfc822.Message(StringIO('\n'.join(request.header)))
         remote_addr, remote_port = request.channel.addr
-        query_string = ''
-        if '?' in request.uri:
-            [request.uri, query_string] = request.uri.split('?', 1)
+        path, params, query_string, fragment = request.split_uri()
+        if query_string.startswith('?'):
+            query_string = query_string[1:]

         environ = {'REQUEST_METHOD': request.command,
                    'ACCEPT_ENCODING': msg.get('Accept-encoding'),
@@ -68,7 +68,7 @@
                    'HTTP_COOKIE': msg.get('Cookie'),
                    'HTTP_REFERER': msg.get('Referer'),
                    'HTTP_USER_AGENT': msg.get('User-agent'),
-                   'PATH_INFO': request.uri,
+                   'PATH_INFO': path,
                    'QUERY_STRING': query_string,
                    'REMOTE_ADDR': remote_addr,
                    'REMOTE_PORT': str(remote_port),

reply