Bug 43151 - [AndroidClientHandler] Doesn't support redirect to-from https/http
Summary: [AndroidClientHandler] Doesn't support redirect to-from https/http
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 6.1.0 (C7)
Hardware: PC Mac OS
: High major
Target Milestone: 7.0 (C8)
Assignee: Marek Habersack
URL:
Depends on:
Blocks:
 
Reported: 2016-08-07 02:02 UTC by Jérémie Laval
Modified: 2016-08-29 13:01 UTC (History)
3 users (show)

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

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:
Status:
VERIFIED FIXED

Description Jérémie Laval 2016-08-07 02:02:55 UTC
The default .NET HttpClientHandler supports redirect without caring about the scheme. The Java underlying HTTPUrlConnection used on Android by the native AndroidHttpClientHandler though document this aspect of redirection as not supported[0] and will result to a throwed exception with a 301 error code for instance.

Test url: http://thehubway.com/data/stations/bikeStations.xml

This 301 redirects successively to https://thehubway.com/data/stations/bikeStations.xml then http://www.thehubway.com/data/stations/bikeStations.xml then finally https://www.thehubway.com/data/stations/bikeStations.xml

[0]  https://developer.android.com/reference/java/net/HttpURLConnection.html
     "Response Handling" section, excerpt: "This implementation doesn't follow redirects from HTTPS to HTTP or vice versa."
Comment 1 Jérémie Laval 2016-08-07 02:06:32 UTC
Bumping priority as the native handler is now selected as the default one by MSBuild[0]

[0]  https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs#L325
Comment 2 Jonathan Pryor 2016-08-17 14:56:11 UTC
Fixed in monodroid/master/3dee6efa, monodroid/cycle8/870e7846, and:

https://github.com/xamarin/xamarin-android/commit/5da5c5e55bda72c8d5cc2100dbafaeb680a6dcbb