Bug 15213 - HTTPWebRequest POST eventually fails when using proxy and NTLM authentication
Summary: HTTPWebRequest POST eventually fails when using proxy and NTLM authentication
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.0.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Martin Baulig
Depends on:
Reported: 2013-10-04 15:00 UTC by Christian Gan
Modified: 2016-11-11 09:46 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Sample application (1.43 MB, application/zip)
2013-10-04 15:01 UTC, Christian Gan

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Christian Gan 2013-10-04 15:00:15 UTC
I initially ran into this while testing web service reference calls to our server through our company proxy.  Eventually all service calls would start to fail and the only work around was to restart our application.  I managed to recreate a similar situation with small application.  My guess is that there is a socket handle leaking somewhere.

See attached example application.

This test simply sends a POST message to any website and looks for any response.  If the response is from the server, the test is considered success, even though the response is not a 200 OK.  In actuality, because we are sending a POST message to a site that likely doesn't support POST, we get a MethodNotAllowed error from the server, which again is OK.

Around the 242nd or 243rd iteration you will start getting internal exceptions and the test will continue to fail afterwards.

Repeatable every time.

A few clues:
 - if a proxy is not used, the test works
 - if the proxy does not use NTLM authentication, the test works
 - if the address uses HTTPS, the test works
 - if the method is a GET, the test works
Comment 1 Christian Gan 2013-10-04 15:01:07 UTC
Created attachment 5065 [details]
Sample application
Comment 2 Christian Gan 2013-11-04 17:03:10 UTC
Hi Martin, have you had a chance to look into this?  Do you need more information?
Comment 3 Martin Baulig 2013-11-06 13:02:48 UTC
Hi Christian,
I'm sorry, I've been very busy with PCL recently, but will have a look at this shortly.  I've also seen some other bug report about leaking sockets somewhere.
Comment 4 Martin Baulig 2013-11-15 09:18:35 UTC
Just wanted to give you a quick update on this:

I haven't looked at your test case yet, but setup a squid proxy with NTLM on my Windows box (the old machine where I did all the previous NTLM work on died with a hard disk crash about half a year ago) and configured IIS with some NTLM features.  And then I started to to find NTLM bugs in Mono, working on fixing them ...
Comment 5 Christian Gan 2013-12-16 16:30:45 UTC
Hi Martin, any progress on this?
Comment 7 Jungmok Han 2014-06-03 18:38:30 UTC
Martin - Any update on this one?
Comment 8 Martin Baulig 2016-11-11 09:46:32 UTC
Closing ancient bugs, please reopen if you're still having this problem.