You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2009/07/08 21:10:53 UTC
svn commit: r792269 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt
httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
Author: olegk
Date: Wed Jul 8 19:10:52 2009
New Revision: 792269
URL: http://svn.apache.org/viewvc?rev=792269&view=rev
Log:
HttpClient will no longer send expired cookies back to the origin server
Modified:
httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=792269&r1=792268&r2=792269&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Wed Jul 8 19:10:52 2009
@@ -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>
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java?rev=792269&r1=792268&r2=792269&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java Wed Jul 8 19:10:52 2009
@@ -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 @@
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 (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 + " match " + cookieOrigin);
+ this.log.debug("Cookie " + cookie + " expired");
}
- matchedCookies.add(cookie);
}
}
// Generate Cookie request headers