+2009-09-15 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * DefaultProxyHandler.cs: handle upper and lowercase HTTP_PROXY and
+ the Any address. Fixes bug #537283.
+
2009-06-05 Marek Safar <marek.safar@gmail.com>
* NetConfigurationHandler.cs, DefaultProxyHandler.cs,
//MS: presence of valid address URI takes precedence over usesystemdefault
if (sysdefault != null && String.Compare (sysdefault, "true", true) == 0) {
address = Environment.GetEnvironmentVariable ("http_proxy");
- if (address != null)
+ if (address == null)
+ address = Environment.GetEnvironmentVariable ("HTTP_PROXY");
+
+ if (address != null) {
try {
- ((WebProxy) result).Address = new Uri (address);
- } catch (UriFormatException) {}
+ Uri uri = new Uri (address);
+ IPAddress ip;
+ if (IPAddress.TryParse (uri.Host, out ip)) {
+ if (IPAddress.Any.Equals (ip)) {
+ UriBuilder builder = new UriBuilder (uri);
+ builder.Host = "127.0.0.1";
+ uri = builder.Uri;
+ } else if (IPAddress.IPv6Any.Equals (ip)) {
+ UriBuilder builder = new UriBuilder (uri);
+ builder.Host = "[::1]";
+ uri = builder.Uri;
+ }
+ }
+ ((WebProxy) result).Address = uri;
+ } catch (UriFormatException) { }
+ }
}
continue;
+2009-09-15 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * WebRequest.cs: handle upper and lowercase HTTP_PROXY and the Any
+ address. Fixes bug #537283.
+
2009-09-04 Gonzalo Paniagua Javier <gonzalo@novell.com>
* WebConnection.cs: if the request has already finished reading, don't
public static IWebProxy GetSystemWebProxy ()
{
string address = Environment.GetEnvironmentVariable ("http_proxy");
+ if (address == null)
+ address = Environment.GetEnvironmentVariable ("HTTP_PROXY");
+
if (address != null) {
try {
- WebProxy p = new WebProxy (address);
- return p;
- } catch (UriFormatException) {}
+ if (!address.StartsWith ("http://"))
+ address = "http://" + address;
+ Uri uri = new Uri (address);
+ IPAddress ip;
+ if (IPAddress.TryParse (uri.Host, out ip)) {
+ if (IPAddress.Any.Equals (ip)) {
+ UriBuilder builder = new UriBuilder (uri);
+ builder.Host = "127.0.0.1";
+ uri = builder.Uri;
+ } else if (IPAddress.IPv6Any.Equals (ip)) {
+ UriBuilder builder = new UriBuilder (uri);
+ builder.Host = "[::1]";
+ uri = builder.Uri;
+ }
+ }
+ return new WebProxy (uri);
+ } catch (UriFormatException) { }
}
return new WebProxy ();
}