Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I've been trying to call a web service that is on HTTPS from a device with a HTTP proxy configured. It just doesn't work.
From my packet capture the device looks like it is trying to speak HTTPS to the proxy.
This issue also happens with System.Net.WebClient
Configure your device to use a HTTP proxy (I've used tinyproxy https://banu.com/tinyproxy/ as my server)
Mine is IP: 10.0.210.22, Port: 8888 in the details below
I get the proxy with any of these:
var a = System.Net.WebRequest.DefaultWebProxy;
var b = System.Net.WebRequest.GetSystemWebProxy();
var c = CFNetwork.GetDefaultProxy();
Then set the proxy on my WebClient and try get something by https:
var client = new System.Net.WebClient();
client.Proxy = a;
DownloadString doesn't return until a timeout occurs. A packet capture on the proxy shows some bad data and the proxy does nothing.
I believe the issue is because of this:
Console.WriteLine(a + " " + a.GetProxy(new Uri("https://developers.google.com")));
Which returns: "https://10.0.210.22:8888/"
If I instead do:
string newProxy = a.GetProxy(new Uri(ws.Url)).ToString().Replace("https:", "http:");
Console.WriteLine("Creating proxy for: " + newProxy);
client.Proxy = new System.Net.WebProxy(newProxy);
Now returns: "http://10.0.210.22:8888/"
And the communication all works.
This bug may also appear in MonoMac at a guess.
The CFNetwork API returns (at least using my own configuration) a proxy of type HTTPS - while only a hostname and port are provided to iOS (OSX has far more options, including a separate "Secure Web Proxy").
e.g. CFNetwork.GetProxiesForUri (new Uri ("https://developers.google.com"), settings) .ProxyType;
Of course if the proxy does not support HTTPS connections it will fail (while it works for NSUrl* types). This needs a bit more testing (on OSX) to ensure we get the right behavior in both cases.
https uses http + connect. I could have sworn that was tested for a previous bug report :|
Anyway it's fixed and will be in 5.2.12 (not the upcoming 5.2.11). In the meantime your workaround is fine (and it won't break once the fix is available).
QA: if you can set up a permanent proxy in your testing environment we could add unit tests for this.
Awesome thanks guys! <3