Skip to content

AndroidClientHandler doesn't forward cookies on redirect #3954

@aliriomendes

Description

@aliriomendes

Steps to Reproduce

  1. Execute this code:
var client = new HttpClient(new AndroidClientHandler());
var res = await client.GetAsync("https://oaa365.sharepoint.com/:x:/s/Development/ESKK8ZI2L2NEvKCM-4rN6rcB3a2i3245l_7uw3mERhNcVw?e=GExumW&download=1");

I pulled in the code(AndroidClientHandler) to debug:

if (disposeRet)
{
    ret.Dispose();
    ret = null;
}
else
{
    CopyHeaders(httpConnection, ret);
    ParseCookies(ret, connectionUri);
}

If I change the code to the one bellow the redirect and file download works perfectly

CopyHeaders(httpConnection, ret);
ParseCookies(ret, connectionUri);
if (disposeRet)
{
    ret.Dispose();
    ret = null;
}

Expected Behavior

The cookies are set on redirect and the file is downloaded correctly

Actual Behavior

The cookies are not set on redirect and, after a series of redirect, we end up downloading the login html page.

Version Information

Visual Studio Community 2019 for Mac
Version 8.3.10 (build 2)

Mono Framework MDK
Runtime:
Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
Package version: 604000208

NuGet
Version: 5.3.0.6192

Xamarin.Android
Version: 10.0.6.2 (Visual Studio Community)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/aliriomendes/Library/Android/sdk
Supported Android versions:
4.4 (API level 19)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 28.0.3

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Operating System
Mac OS X 10.15.1
Darwin 19.0.0 Darwin Kernel Version 19.0.0
Thu Oct 17 16:17:15 PDT 2019
root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions