Skip to content

Commit

Permalink
Parse cookies on redirect (#6987)
Browse files Browse the repository at this point in the history
Fixes: #3954

When using the `AllowAutoRedirect` feature of `AndroidMessageHandler` to automatically follow 3xx redirects, 
the cookies that are returned together with the redirection are not processed. If the redirection target requires 
the cookies returned by the first request, the call will fail.

This change fixes this behavior and always processes the cookies before the redirection takes place.
  • Loading branch information
dominik-weber committed May 6, 2022
1 parent 82d16ae commit efb693f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs
Expand Up @@ -582,12 +582,12 @@ internal Task WriteRequestContentToOutputInternal (HttpRequestMessage request, H
}
}

CopyHeaders (httpConnection, ret);
ParseCookies (ret, connectionUri);

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

// We don't want to pass the authorization header onto the next location
Expand Down

0 comments on commit efb693f

Please sign in to comment.