Skip to content

Commit

Permalink
HttpClient 4.4 RC1 tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ok2c committed Jan 24, 2015
2 parents eff30c7 + 0baed01 commit 2782e56
Show file tree
Hide file tree
Showing 137 changed files with 4,279 additions and 1,376 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache HttpComponents Client
Copyright 1999-2014 The Apache Software Foundation
Copyright 1999-2015 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
76 changes: 76 additions & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
Release 4.4 Final
-------------------

This is the first stable (GA) release of HttpClient 4.4. Notable features and enhancements included
in 4.4 series are:

* Support for the latest HTTP state management specification (RFC 6265). Please note that the old
cookie policy is still used by default for compatibility reasons. RFC 6265 compliant cookie
policies need to be explicitly configured by the user. Please also note that as of next feature
release support for Netscape draft, RFC 2109 and RFC 2965 cookie policies will be deprecated
and disabled by default. It is recommended to use RFC 6265 compliant policies for new applications
unless compatibility with RFC 2109 and RFC 2965 is required and to migrate existing applications
to the default cookie policy.

* Enhanced, redesigned and rewritten default SSL hostname verifier with improved RFC 2818
compliance

* Default SSL hostname verifier and default cookie policy now validate certificate identity
and cookie domain of origin against the public suffix list maintained by Mozilla.org
<https://publicsuffix.org/list>

* More efficient stale connection checking: indiscriminate connection checking which results
in approximately 20 to 50 ms overhead per request has been deprecated in favor of conditional
connection state validation (persistent connections are to be re-validated only if a specified
period inactivity has elapsed)

* Authentication cache thread-safety: authentication cache used by HttpClient is now thread-safe
and can be shared by multiple threads in order to re-use authentication state for subsequent
requests

* Native Windows Negotiate and NTLM via SSPI through JNA: when running on Windows OS HttpClient
configured to use native NTLM or SPNEGO authentication schemes can make use of platform specific
functionality via JNA and current user credentials. This functionality is still considered
experimental, known to have compatibility issues and subject to change without prior notice.
Use at your discretion.

This release also includes all fixes from the stable 4.3.x release branch.

Please note that as of 4.4 HttpClient requires Java 1.6 or newer.


Changelog:
-------------------

* Support for the latest HTTP state management specification (RFC 6265).
Contributed by Oleg Kalnichevski <olegk at apache.org>

* [HTTPCLIENT-1515] Caching of responses to HEAD requests
Contributed by Tyrone Cutajar <tj.cutajar at gmail.com> and
Francois-Xavier Bonnet <fx at apache.org>

* [HTTPCLIENT-1560] Native Windows auth improvements
Contributed by Michael Osipov <michaelo at apache.org>

* Update Apache Commons Logging version from 1.1.3 to 1.2.
Contributed by Gary Gregory <ggregory at apache.org>

* Update Apache Commons Codec version from 1.6 to 1.9.
Contributed by Gary Gregory <ggregory at apache.org>

* Update Ehcache version from 2.2.0 to 2.6.9.
Contributed by Gary Gregory <ggregory at apache.org>

* Update Ehcache version from 2.2.0 to 2.6.9.
Contributed by Gary Gregory <ggregory at apache.org>

* Update Spymemcached version from 2.6 to 2.11.4.
Contributed by Gary Gregory <ggregory at apache.org>

* Update SLF4J version from 1.5.11 to 1.7.7.
Contributed by Gary Gregory <ggregory at apache.org>





Release 4.4 BETA1
-------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import org.apache.http.Consts;
import org.apache.http.entity.ContentType;

/**
* This class represents arbitrary content of a specfic type that can be consumed
* multiple times and requires no explicit deallocation.
*/
public class Content {

public static final Content NO_CONTENT = new Content(new byte[] {}, ContentType.DEFAULT_BINARY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,26 @@
import java.io.IOException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.AbstractResponseHandler;
import org.apache.http.util.EntityUtils;

class ContentResponseHandler implements ResponseHandler<Content> {
/**
* {@link org.apache.http.client.ResponseHandler} implementation that converts
* {@link org.apache.http.HttpResponse} messages to {@link org.apache.http.client.fluent.Content}
* instances.
*
* @see org.apache.http.client.fluent.Content
*
* @since 4.4
*/
public class ContentResponseHandler extends AbstractResponseHandler<Content> {

@Override
public Content handleResponse(
final HttpResponse response) throws ClientProtocolException, IOException {
final StatusLine statusLine = response.getStatusLine();
final HttpEntity entity = response.getEntity();
if (statusLine.getStatusCode() >= 300) {
throw new HttpResponseException(statusLine.getStatusCode(),
statusLine.getReasonPhrase());
}
if (entity != null) {
return new Content(
EntityUtils.toByteArray(entity),
ContentType.getOrDefault(entity));
}
return Content.NO_CONTENT;
public Content handleEntity(final HttpEntity entity) throws IOException {
return entity != null ?
new Content(EntityUtils.toByteArray(entity), ContentType.getOrDefault(entity)) :
Content.NO_CONTENT;
}

}
24 changes: 12 additions & 12 deletions httpclient-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>spy</groupId>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<scope>compile</scope>
<optional>true</optional>
Expand Down Expand Up @@ -124,16 +124,16 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand All @@ -142,7 +142,7 @@

<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${hc.javadoc.version}</version>
<version>${hc.javadoc.version}</version>
<configuration>
<!-- reduce console output. Can override with -Dquiet=false -->
<quiet>true</quiet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ private HttpResponse generateCachedResponse(final HttpRequestWrapper request,
|| request.containsHeader(HeaderConstants.IF_MODIFIED_SINCE)) {
cachedResponse = responseGenerator.generateNotModifiedResponse(entry);
} else {
cachedResponse = responseGenerator.generateResponse(entry);
cachedResponse = responseGenerator.generateResponse(request, entry);
}
setResponseStatus(context, CacheResponseStatus.CACHE_HIT);
if (validityPolicy.getStalenessSecs(entry, now) > 0L) {
Expand All @@ -609,7 +609,7 @@ private HttpResponse handleRevalidationFailure(final HttpRequestWrapper request,
if (staleResponseNotAllowed(request, entry, now)) {
return generateGatewayTimeout(context);
} else {
return unvalidatedCacheHit(context, entry);
return unvalidatedCacheHit(request, context, entry);
}
}

Expand All @@ -619,9 +619,11 @@ private HttpResponse generateGatewayTimeout(final HttpContext context) {
HttpStatus.SC_GATEWAY_TIMEOUT, "Gateway Timeout");
}

private HttpResponse unvalidatedCacheHit(final HttpContext context,
private HttpResponse unvalidatedCacheHit(
final HttpRequestWrapper request,
final HttpContext context,
final HttpCacheEntry entry) {
final HttpResponse cachedResponse = responseGenerator.generateResponse(entry);
final HttpResponse cachedResponse = responseGenerator.generateResponse(request, entry);
setResponseStatus(context, CacheResponseStatus.CACHE_HIT);
cachedResponse.addHeader(HeaderConstants.WARNING, "111 localhost \"Revalidation failed\"");
return cachedResponse;
Expand Down Expand Up @@ -819,7 +821,7 @@ HttpResponse negotiateResponseFromVariants(final HttpHost target,
conditionalRequest, requestDate, responseDate, backendResponse,
matchingVariant, matchedEntry);

final HttpResponse resp = responseGenerator.generateResponse(responseEntry);
final HttpResponse resp = responseGenerator.generateResponse(request, responseEntry);
tryToUpdateVariantMap(target, request, matchingVariant);

if (shouldSendNotModifiedResponse(request, responseEntry)) {
Expand Down Expand Up @@ -901,13 +903,13 @@ HttpResponse revalidateCacheEntry(
&& suitabilityChecker.allConditionalsMatch(request, updatedEntry, new Date())) {
return responseGenerator.generateNotModifiedResponse(updatedEntry);
}
return responseGenerator.generateResponse(updatedEntry);
return responseGenerator.generateResponse(request, updatedEntry);
}

if (staleIfErrorAppliesTo(statusCode)
&& !staleResponseNotAllowed(request, cacheEntry, getCurrentDate())
&& validityPolicy.mayReturnStaleIfError(request, cacheEntry, responseDate)) {
final HttpResponse cachedResponse = responseGenerator.generateResponse(cacheEntry);
final HttpResponse cachedResponse = responseGenerator.generateResponse(request, cacheEntry);
cachedResponse.addHeader(HeaderConstants.WARNING, "110 localhost \"Response is stale\"");
final HttpEntity errorBody = backendResponse.getEntity();
if (errorBody != null) {
Expand Down
Loading

0 comments on commit 2782e56

Please sign in to comment.