mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-22 18:05:40 +00:00
HttpClient will no longer send expired cookies back to the origin server
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@792269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
be2367cd91
commit
2b69ac0ae9
@ -1,6 +1,9 @@
|
||||
Changes since 4.0 beta 2
|
||||
-------------------
|
||||
|
||||
* HttpClient will no longer send expired cookies back to the origin server.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
* [HTTPCLIENT-856] Proxy NTLM authentication no longer fails on a redirect to
|
||||
a different host.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
@ -35,6 +35,7 @@
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.jcip.annotations.Immutable;
|
||||
@ -173,12 +174,19 @@ public void process(final HttpRequest request, final HttpContext context)
|
||||
List<Cookie> cookies = new ArrayList<Cookie>(cookieStore.getCookies());
|
||||
// Find cookies matching the given origin
|
||||
List<Cookie> matchedCookies = new ArrayList<Cookie>();
|
||||
Date now = new Date();
|
||||
for (Cookie cookie : cookies) {
|
||||
if (cookieSpec.match(cookie, cookieOrigin)) {
|
||||
if (this.log.isDebugEnabled()) {
|
||||
this.log.debug("Cookie " + cookie + " match " + cookieOrigin);
|
||||
if (cookie.getExpiryDate() == null || cookie.getExpiryDate().after(now)) {
|
||||
if (cookieSpec.match(cookie, cookieOrigin)) {
|
||||
if (this.log.isDebugEnabled()) {
|
||||
this.log.debug("Cookie " + cookie + " match " + cookieOrigin);
|
||||
}
|
||||
matchedCookies.add(cookie);
|
||||
}
|
||||
} else {
|
||||
if (this.log.isDebugEnabled()) {
|
||||
this.log.debug("Cookie " + cookie + " expired");
|
||||
}
|
||||
matchedCookies.add(cookie);
|
||||
}
|
||||
}
|
||||
// Generate Cookie request headers
|
||||
|
Loading…
x
Reference in New Issue
Block a user