[Medusa-dev] Small patch to move URI unquoting in http_server.py
Bill Janssen
janssen at parc.com
Mon Jun 30 14:22:51 EDT 2003
Yes, I'd like to see this in the CVS too.
Bill
> Hi!
>
> Attached a patch for the http_server.py problem with unescaping of %XX forms in
> the whole request instead just the path. This is what I use in my tools to
> prevent medusa from unescaping too much.
>
> Would be great if this (or something like this, reason below) could make it into
> the next version of medusa, as this bug really is a bit annoying - for example
> it prevents you from passing parameters using ";" in their value, or pass in
> parameters that themselves contain other URLs.
>
> The patch just pulls out the path element from the request and only unescapes
> this and reconstructs the request.
>
> Actually this patch now unquotes not only the path, but given the form:
>
> /path/to/method;attr=value;another=value?query=blah&q2=blubb#fragmentpart
>
> splits at the '?' and unquotes the first part. Maybe (or most surely) this
> should be reworked to use split_query from medusa itself and reconstruct the
> split request, after unquoting only the path element.
>
> [murphy:~] gb% diff
> /Volumes/Datensicherungen/opt/pyds/lib/python2.2/site-packages/medusa/
> http_server.py /opt/pyds/lib/python2.2/site-packages/medusa/http_server.py
> 32c32
> < from urllib import unquote
> ---
> > from urllib import unquote, splitquery
> 473,474c473,478
> < if '%' in request:
> < request = unquote (request)
> ---
> > rpath, rquery = splitquery(request)
> > if '%' in rpath:
> > if rquery:
> > request = unquote (rpath) + '?' + rquery
> > else:
> > request = unquote (rpath)
>
> bye, Georg
>
> _______________________________________________
> Medusa-dev mailing list
> Medusa-dev at python.org
> http://mail.python.org/mailman/listinfo/medusa-dev
More information about the Medusa-dev
mailing list