-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cookie_store not working over redirections #510
Comments
I have got the same issue, then I tried to dive into code and spot the following: match action {
redirect::Action::Follow => {
self.url = loc;
remove_sensitive_headers(&mut self.headers, &self.url, &self.urls);
debug!("redirecting to {:?} '{}'", self.method, self.url);
let uri = expect_uri(&self.url);
let body = match self.body {
Some(Some(ref body)) => ::hyper::Body::from(body.clone()),
_ => ::hyper::Body::empty(),
};
let mut req = ::hyper::Request::builder()
.method(self.method.clone())
.uri(uri.clone())
.body(body)
.expect("valid request parts");
*req.headers_mut() = self.headers.clone();
// Add a print message to header to see what's going on..
println!("Redirected request: {:?}", req);
// End...
self.in_flight = self.client.hyper.request(req);
continue;
}
...
} // end of match in the async_impl/client.rs (Sorry for the tupid println!, but I don't know how to debug yet =.= ) According to the print message, I find that the redirected request doesn't contains |
That doesn't seem very hard to fix, we should have access to |
Excellent work digging through, @WindSoilder! It appears the fix here involves these steps:
If anyone wish to take a stab an open a PR, I can help direct the effort! |
I'm trying to run a login process through request which involves a lot of redirections.
My client is of course setup with
cookie_store(true)
.Having looked at the debug logs, it feels like cookies are set when receiving a Set-Cookie header, but that they are not used until the next call to reqwest, that is, the request subsequent to the response that was both a Set-Cookie and a redirect does not have these cookies set.
Can you confirm this behaviour and help me out at properly passing these cookies in that kind of scenario ?
The text was updated successfully, but these errors were encountered: