Skip to content

Commit

Permalink
Update http-core and http-client dependencies (elastic#46549)
Browse files Browse the repository at this point in the history
* Update http-core and http-client dependencies

Relates to elastic#45808
Closes elastic#45577

* update shas dependencies

* update test
  • Loading branch information
javanna committed Sep 11, 2019
1 parent a1fbc0a commit ddfb8ad
Show file tree
Hide file tree
Showing 47 changed files with 57 additions and 41 deletions.
4 changes: 2 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ bouncycastle = 1.61
# test dependencies
randomizedrunner = 2.7.1
junit = 4.12
httpclient = 4.5.8
httpcore = 4.4.11
httpclient = 4.5.10
httpcore = 4.4.12
httpasyncclient = 4.1.4
commonslogging = 1.1.3
commonscodec = 1.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ public GetSnapshotLifecycleStatsResponse getSnapshotLifecycleStats(GetSnapshotLi
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
*/
public void getSnapshotLifecycleStatsAsync(GetSnapshotLifecycleStatsRequest request, RequestOptions options,
public Cancellable getSnapshotLifecycleStatsAsync(GetSnapshotLifecycleStatsRequest request, RequestOptions options,
ActionListener<GetSnapshotLifecycleStatsResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::getSnapshotLifecycleStats,
return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::getSnapshotLifecycleStats,
options, GetSnapshotLifecycleStatsResponse::fromXContent, listener, emptySet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ public Cancellable invalidateApiKeyAsync(final InvalidateApiKeyRequest request,
* authenticated TLS session, and it is validated by the PKI realms with {@code delegation.enabled} toggled to {@code true}.<br>
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delegate-pki-authentication.html"> the
* docs</a> for more details.
*
*
* @param request the request containing the certificate chain
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response from the delegate-pki-authentication API key call
Expand All @@ -1031,14 +1031,14 @@ public DelegatePkiAuthenticationResponse delegatePkiAuthentication(DelegatePkiAu
* {@code true}.<br>
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delegate-pki-authentication.html"> the
* docs</a> for more details.
*
*
* @param request the request containing the certificate chain
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
*/
public void delegatePkiAuthenticationAsync(DelegatePkiAuthenticationRequest request, RequestOptions options,
public Cancellable delegatePkiAuthenticationAsync(DelegatePkiAuthenticationRequest request, RequestOptions options,
ActionListener<DelegatePkiAuthenticationResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::delegatePkiAuthentication, options,
return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::delegatePkiAuthentication, options,
DelegatePkiAuthenticationResponse::fromXContent, listener, emptySet());
}
}
1 change: 1 addition & 0 deletions client/rest/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion client/rest/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion client/rest/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/rest/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 0 additions & 1 deletion client/rest/licenses/httpcore-nio-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/rest/licenses/httpcore-nio-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84cd29eca842f31db02987cfedea245af020198b
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void startHttpServer() throws Exception {
int numHttpServers = randomIntBetween(2, 4);
httpServers = new HttpServer[numHttpServers];
httpHosts = new HttpHost[numHttpServers];
waitForCancelHandler = new WaitForCancelHandler();
for (int i = 0; i < numHttpServers; i++) {
HttpServer httpServer = createHttpServer();
httpServers[i] = httpServer;
Expand All @@ -98,24 +99,30 @@ private static HttpServer createHttpServer() throws Exception {
for (int statusCode : getAllStatusCodes()) {
httpServer.createContext(pathPrefix + "/" + statusCode, new ResponseHandler(statusCode));
}
waitForCancelHandler = new WaitForCancelHandler();
httpServer.createContext(pathPrefix + "/wait", waitForCancelHandler);
return httpServer;
}

private static class WaitForCancelHandler implements HttpHandler {
private CountDownLatch cancelHandlerLatch;
private volatile CountDownLatch requestCameInLatch;
private volatile CountDownLatch cancelHandlerLatch;

void reset() {
cancelHandlerLatch = new CountDownLatch(1);
requestCameInLatch = new CountDownLatch(1);
}

void cancelDone() {
cancelHandlerLatch.countDown();
}

void awaitRequest() throws InterruptedException {
requestCameInLatch.await();
}

@Override
public void handle(HttpExchange exchange) throws IOException {
requestCameInLatch.countDown();
try {
cancelHandlerLatch.await();
} catch (InterruptedException ignore) {
Expand Down Expand Up @@ -226,15 +233,12 @@ public void onFailure(Exception exception) {

public void testCancelAsyncRequests() throws Exception {
int numRequests = randomIntBetween(5, 20);
final CountDownLatch latch = new CountDownLatch(numRequests);
final List<Response> responses = new CopyOnWriteArrayList<>();
final List<Exception> exceptions = new CopyOnWriteArrayList<>();
for (int i = 0; i < numRequests; i++) {
CountDownLatch latch = new CountDownLatch(1);
waitForCancelHandler.reset();
final String method = RestClientTestUtil.randomHttpMethod(getRandom());
//we don't test status codes that are subject to retries as they interfere with hosts being stopped
final int statusCode = randomBoolean() ? randomOkStatusCode(getRandom()) : randomErrorNoRetryStatusCode(getRandom());
Cancellable cancellable = restClient.performRequestAsync(new Request(method, "/" + statusCode), new ResponseListener() {
Cancellable cancellable = restClient.performRequestAsync(new Request("GET", "/wait"), new ResponseListener() {
@Override
public void onSuccess(Response response) {
responses.add(response);
Expand All @@ -247,10 +251,15 @@ public void onFailure(Exception exception) {
latch.countDown();
}
});
if (randomBoolean()) {
//we wait for the request to get to the server-side otherwise we almost always cancel
// the request artificially on the client-side before even sending it
waitForCancelHandler.awaitRequest();
}
cancellable.cancel();
waitForCancelHandler.cancelDone();
assertTrue(latch.await(5, TimeUnit.SECONDS));
}
assertTrue(latch.await(5, TimeUnit.SECONDS));
assertEquals(0, responses.size());
assertEquals(numRequests, exceptions.size());
for (Exception exception : exceptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private HttpServer createHttpServer() throws Exception {
return httpServer;
}

private class WaitForCancelHandler implements HttpHandler {
private static class WaitForCancelHandler implements HttpHandler {

private final CountDownLatch cancelHandlerLatch = new CountDownLatch(1);

Expand Down Expand Up @@ -259,6 +259,8 @@ public void onFailure(Exception exception) {
/**
* This test verifies some assumptions that we rely upon around the way the async http client works when reusing the same request
* throughout multiple retries, and the use of the {@link HttpRequestBase#abort()} method.
* In fact the low-level REST client reuses the same request instance throughout multiple retries, and relies on the http client
* to set the future ref to the request properly so that when abort is called, the proper future gets cancelled.
*/
public void testRequestResetAndAbort() throws Exception {
try (CloseableHttpAsyncClient client = HttpAsyncClientBuilder.create().build()) {
Expand All @@ -273,10 +275,15 @@ public void testRequestResetAndAbort() throws Exception {
{
httpGet.reset();
assertFalse(httpGet.isAborted());
httpGet.abort();//this has no effect on the next call (although isAborted will return true until the next reset)
httpGet.abort();
Future<HttpResponse> future = client.execute(httpHost, httpGet, null);
assertEquals(200, future.get().getStatusLine().getStatusCode());
assertFalse(future.isCancelled());
try {
future.get();
fail("expected cancellation exception");
} catch(CancellationException e) {
//expected
}
assertTrue(future.isCancelled());
}
{
httpGet.reset();
Expand Down
1 change: 1 addition & 0 deletions client/sniffer/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion client/sniffer/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion client/sniffer/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/sniffer/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/discovery-ec2/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/discovery-ec2/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/discovery-ec2/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/discovery-ec2/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/discovery-gce/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/discovery-gce/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/discovery-gce/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/discovery-gce/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/repository-gcs/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/repository-gcs/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/repository-gcs/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/repository-gcs/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/repository-s3/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/repository-s3/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/repository-s3/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/repository-s3/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpcore-nio-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpcore-nio-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84cd29eca842f31db02987cfedea245af020198b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b195778247a21e980cb9f80c41364dc0c38feaef

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/snapshot-tool/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion x-pack/snapshot-tool/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/snapshot-tool/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/snapshot-tool/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132

0 comments on commit ddfb8ad

Please sign in to comment.