Repository navigation
CurlHandler fix for cookie handling - #5080
Conversation
|
cc @vijaykota @davidsh @stephentoub This and #5001 together fix #4960 |
|
The OpenSUSE failure is unrelated: |
|
LGTM |
|
Test Innerloop OpenSUSE13.2 Debug Build and Test |
|
Test Innerloop Debug Build and Test ( #5083 ) |
|
@dotnet-bot test this please |
There was a problem hiding this comment.
Is state._requestMessage.RequestUri the original URI or the new redirected URI? I wasn't sure looking at this code.
But for this to be correct, the RequestUri still needs to be the original URI while processing the response cookies. After the response cookies are processed completely, then the RequestUri can be updated to the new redirected URI as given in the 3xx HTTP response.
There was a problem hiding this comment.
(sorry, missed this comment. I did get the email notification but I could not find the comment here till now. )
I see my mistake in the code. In WinHttpHandler, adding into CookieContainer happens before setting the url
There was a problem hiding this comment.
Sorry I didn't understand this, @kapilash. Didn't we discuss that this is the behavior we need ie. the cookie container should contain the target (new) url? You had mentioned that if we were to use the old url, on the second hop, a cookie would not be found for the new url and the test case would fail
There was a problem hiding this comment.
You had mentioned that if we were to use the old url, on the second hop, a cookie would not be found for the new url and the test case would fail
Yes, @vijaykota. You were right all along. I based my understanding on what was happening when the test case is running and my misreading of WinHttpHandler.
|
The failure seems to be related to #5082 . Request for re tests are still including the OpenSuse build and test. So trying to close and reopen and hope #5083 will come into play. |
24e8c59 to
742f660
Compare
CurlHandler has been handling cookies only from the final HTTP response. The cookies sent during the intermediate http responses (during 3XX redirection as well as interim 401, 407 responses) were getting ignored. This fix ensures that the cookies from all the responses are handled.
I don't understand the answer to my questions about the uri being used to add the response cookies to the container. The original uri should be used at all times when adding HTTP response cookies (i.e. Set-Cookie headers) to the container. Regardless of whether it is a 3xx (redirection response) or a 401/407 (auth response), the original uri used for that request needs to be used when adding the cookies to the cookie container. In this case of the 3xx redirection response, the HttpRequestMessage.RequestUri should only be updated after the response cookies have been parsed and added to the container. |
|
@dotnet-bot test this please |
Thanks @davidsh. The code has been updated to reflect this. The cookie container is updated based on the original target uri. |
|
LGTM |
CurlHandler fix for cookie handling
CurlHandler has been handling cookies only from the final HTTP response.
The cookies sent during the intermediate http responses (during 3XX redirection as well as interim 401, 407 responses) were getting ignored.
This fix ensures that the cookies from all the responses are handled.