You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
r.http is not passing back cookies sent during digest authentication #3469
There has been some back-and-forth in the tests about whether cookies are required during digest authentication. Put simply here is what is happening:
r.http connects to the server
the server responds with a 401 response with the auth-request headers, adding in a cookie header
r.http follows through on the auth-request properly, but does not send back the cookie from step 2
httpbin checks for the cookie, and sends back a 401 code.
Part of the lack of clarity has been both that httpbin is currently indiscriminate when it checks for cookies that it set, so we have been working around this by always sending cookies (both steps 1 and 3), and so there is some cookie on step 3, making httpbin happy. The issue in for httpbin is postmanlabs/httpbin#124
My guess is that we are not specifically turning on libcurl's cookie jar for the session, and so it is not doing this correctly. This might be as easy as just enabling that if we already have the concept of a session, although it might get more complicated if r.http sessions can bounce around among the worker processes.
Note that I am keeping the work-around in the tests for the moment.
Given an empty or non-existing file or by passing the empty string ("") to this option, you can enable the cookie engine without reading any initial cookies.
@danielmewes, it would be pretty easy to enable this, but at the moment we do not share cURL sessions across requests. For example, when performing depagination, each subsequent request will be sent to an arbitrary worker process, authenticate using a new CURL* handle, and thus have its own set of cookies.
This is still probably better than what we do now, considering some servers may require cookies.
This has been fixed and merged into next in commits daa6031 (cookies in a single r.http session) and 4621c45 (saving and restoring cookies across multiple workers for multiple-request r.http). Review was 2419. Will be in release 1.16.
Activity
danielmewes commentedon Dec 23, 2014
Ping @Tryneus. Would we use a single session for this sequence of requests?
It seems that the way to enable the cookie engine in libcurl without having to specify a path for permanently storying them is through the CURLOPT_COOKIEFILE flag:
http://curl.haxx.se/libcurl/c/CURLOPT_COOKIEFILE.html
Maybe it would be enough to set that option?
Tryneus commentedon Dec 23, 2014
@danielmewes, it would be pretty easy to enable this, but at the moment we do not share cURL sessions across requests. For example, when performing depagination, each subsequent request will be sent to an arbitrary worker process, authenticate using a new
CURL*handle, and thus have its own set of cookies.This is still probably better than what we do now, considering some servers may require cookies.
Tryneus commentedon Jan 5, 2015
This has been fixed and merged into
nextin commits daa6031 (cookies in a singler.httpsession) and 4621c45 (saving and restoring cookies across multiple workers for multiple-requestr.http). Review was 2419. Will be in release 1.16.