You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Steve Johnson <sj...@mercury.com> on 2004/07/07 17:53:03 UTC
URL escaping
Hi All,
Here is a URL that throws an exception if passed to GetMethod as is:
throws something like invalid argument or uri.
It appears to be the unescaped characters in /tr/cl/1,,TRAVELOCITY|987,00.html
The problem is if the whole string is escaped then these escaped characters are double encoded: %3fService%3d
to %325fService%253d
which causes a server error 500.
http://tr.travelocity.com/tr/cl/1,,TRAVELOCITY|987,00.html?s=hp1
<http://tr.travelocity.com/tr/cl/1,,TRAVELOCITY|987,00.html?s=hp1&c=hdstuff&URL=https://dps1.travelocity.com/l
ognlogin.ctl%3fService%3dTRAVELOCITY%26tr_module%3dRETR%26SEQ%3d1372136878108921366819>
&c=hdstuff&URL=https://dps1.travelocity.com/lognlogin.ctl%3fService%3dTRAVELOCITY%26tr_module%3dRETR%26SEQ%3d1
372136878108921366819
Is there a simple way to send any request without complaining about the URI?
If this URL is pasted into IE it works.
Currently doing this:
URI parsedURI = null;
// if at first you don't succeed.
try {
try { // again.
parsedURI = new URI(url.toCharArray()); // This throws on the URL above
} catch (URIException e) {
parsedURI = new URI(url, I18N.getDefaultEncoding()); // This double encodes the URL above.
}
} catch (URIException e) {
}
Thanks for your time and help,
Steve
Steve Johnson
Software Engineer
Mercury Interactive
720 564 - 6532
USA, Canada and the Americas
720 564-6620
Hours: M-F 08:00-17:00 MST (Mountain Standard Time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<http://www.mercuryinteractive.com> http://www.mercuryinteractive.com
Looking for Answers to your SiteScope or SiteSeer questions? <http://support.mercuryinteractive.com>
http://support.mercuryinteractive.com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Re: URL escaping
Posted by Roland Weber <RO...@de.ibm.com>.
Hi Steve,
the comma is a reserved character, and the vertical bar is
an excluded character in RFC 2396 (URI Generic Syntax).
Try to escape just those characters in the part before "?".
cheers,
Roland
Steve Johnson <sj...@mercury.com>
07.07.2004 17:53
Please respond to
"Commons HttpClient Project"
To
"'commons-httpclient-dev@jakarta.apache.org'"
<co...@jakarta.apache.org>
cc
Subject
URL escaping
Hi All,
Here is a URL that throws an exception if passed to GetMethod as is:
throws something like invalid argument or uri.
It appears to be the unescaped characters in
/tr/cl/1,,TRAVELOCITY|987,00.html
The problem is if the whole string is escaped then these escaped
characters are double encoded: %3fService%3d
to %325fService%253d
which causes a server error 500.
http://tr.travelocity.com/tr/cl/1,,TRAVELOCITY|987,00.html?s=hp1
<
http://tr.travelocity.com/tr/cl/1,,TRAVELOCITY|987,00.html?s=hp1&c=hdstuff&URL=https://dps1.travelocity.com/l
ognlogin.ctl%3fService%3dTRAVELOCITY%26tr_module%3dRETR%26SEQ%3d1372136878108921366819>
&c=hdstuff&URL=https://dps1.travelocity.com/lognlogin.ctl%3fService%3dTRAVELOCITY%26tr_module%3dRETR%26SEQ%3d1
372136878108921366819
Is there a simple way to send any request without complaining about the
URI?
If this URL is pasted into IE it works.
Currently doing this:
URI parsedURI = null;
// if at first you don't succeed.
try {
try { // again.
parsedURI = new URI(url.toCharArray()); // This throws on
the URL above
} catch (URIException e) {
parsedURI = new URI(url, I18N.getDefaultEncoding()); //
This double encodes the URL above.
}
} catch (URIException e) {
}
Thanks for your time and help,
Steve
Steve Johnson
Software Engineer
Mercury Interactive
720 564 - 6532
USA, Canada and the Americas
720 564-6620
Hours: M-F 08:00-17:00 MST (Mountain Standard Time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<http://www.mercuryinteractive.com> http://www.mercuryinteractive.com
Looking for Answers to your SiteScope or SiteSeer questions? <
http://support.mercuryinteractive.com>
http://support.mercuryinteractive.com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^