[hobbit] Http test behind proxy
Henrik Stoerner
henrik at hswn.dk
Fri Jan 28 20:30:23 CET 2005
On Fri, Jan 28, 2005 at 01:42:51PM -0500, Kevin Hanrahan wrote:
> If your proxy requires authentication, you can specify the username and
> password inside the proxy-part of the URL, e.g.
>
> http://fred:Wilma1@webproxy.sample.com:3128/http://www.foo.com/
> will authenticate to the proxy using a username of "fred" and a password of
> "Wilma1", before requesting the proxy to fetch the www.foo.com homepage
>
> But my password contains the "@" symbol
Yuck - and you're in trouble too if it contains a ":". Right ...
How about escaping it the way you normally do with URL's ? I.e instead
of "@" you'd have "%40" (because the ascii value for "@" is hex 40),
does that seem reasonable ?
If so, then it's a simple one-line change. And it will only break the
setup for those who already use authentication and have a "%" in their
username or password ...
--- lib/url.c 2005/01/20 22:02:23 1.9
+++ lib/url.c 2005/01/28 19:28:31
@@ -353,7 +353,7 @@
p = strchr(netloc, '@');
if (p) {
*p = '\0';
- url->auth = strdup(netloc);
+ url->auth = strdup(urlunescape(netloc));
netloc = (p+1);
}
p = strchr(netloc, '=');
Henrik
More information about the Xymon
mailing list