Bug 20446 - Send Https POST request to server with self-signed certificate using HttpRequest times out instead of authentication error
Summary: Send Https POST request to server with self-signed certificate using HttpRequ...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.12.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Martin Baulig
Depends on:
Reported: 2014-06-06 18:03 UTC by Ye Tian
Modified: 2016-11-11 09:47 UTC (History)
2 users (show)

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

Sample project (23.22 KB, application/x-zip-compressed)
2014-06-06 18:03 UTC, Ye Tian

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 Ye Tian 2014-06-06 18:03:43 UTC
Created attachment 7008 [details]
Sample project

I'm using HTTPRequest to POST message to a HTTPS server that uses self-signed certificate.

Before I upgrade my Xamarin to 3.0, using Xamarin 1.12, HTTPRequest object gives an authentication error, so that I can prompt user to let him/her choose to accept or not. 

However, using Xamarin 3.0, the object only times out. HTTP Get works fine btw. POST does not work as expected.

I attached a sample project to reproduce the problem.
Comment 1 Ram Chandra 2014-06-10 12:30:34 UTC
I tried to reproduce this issue but I am unable to reproduce this issue, we may have to see if a developer can figure out what's going on from the sample project. If you have a chance, it might also be helpful to include some other pieces of information.

Could you please provide url of HTTPS server which uses self-signed certificate. So that I can reproduce this issue at our end?
Comment 2 Ye Tian 2014-06-10 18:21:26 UTC
Try post an empty json object "{}" to https://tttyy.co/IMSService/ConnectionService.svc/UserLoginByUsername. 

If using http post, you'll get 400 error, which is expected.
If using https post, it times out instead of giving an authentication error.
Comment 3 Ram Chandra 2014-06-12 13:44:34 UTC
I have tried the attached sample with the url which is mentioned on "Comment 2"  and I observed that when I run the sample with https post I am not getting time out exception instead of it I am getting  following exception.

Exception: "System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure--> System.Exception: at System.Net.WebConnection."

Screencast: http://www.screencast.com/t/oQEl7DEpB64c

However, when I have check this issue with xamarin for VS 1.12.278 I am getting authentication error.

Exception : "System.Net.WebException: Error writing request: The authentication or decryption has failed" 

Screencast: http://www.screencast.com/t/HbllMSuhf

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.50938

Xamarin (d3cf238e3845e930e312b6ec9b4c6c5437c33067)
Xamarin.Android (b5dc5ce91305e19de51d71a1122c109719c4bc34)
Comment 4 Ye Tian 2014-06-12 13:59:52 UTC
Yeah, that's what I'm talking about, authentication error is what should be expected. Thanks for reproduce it.
Comment 5 Martin Baulig 2016-11-11 09:47:55 UTC
Closing ancient bugs, please reopen if you're still having this problem.