Update httpclient and dependencies
The new release fixes a number of bugs [1]. Also replace deprecated DefaultHttpClient with HttpClientBuilder. [1] http://www.apache.org/dist/httpcomponents/httpclient/\ RELEASE_NOTES-4.3.x.txt Change-Id: I3cdd566d5edf313673d79df3707de010a395b5b6
This commit is contained in:
parent
0a6a19db67
commit
b1e9143246
@ -18,8 +18,10 @@ import com.google.common.base.CharMatcher;
|
||||
|
||||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.client.BasicCredentialsProvider;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
@ -28,7 +30,7 @@ public class HttpSession {
|
||||
|
||||
protected final String url;
|
||||
private final TestAccount account;
|
||||
private DefaultHttpClient client;
|
||||
private HttpClient client;
|
||||
|
||||
public HttpSession(GerritServer server, TestAccount account) {
|
||||
this.url = CharMatcher.is('/').trimTrailingFrom(server.getUrl());
|
||||
@ -40,13 +42,19 @@ public class HttpSession {
|
||||
return new HttpResponse(getClient().execute(get));
|
||||
}
|
||||
|
||||
protected DefaultHttpClient getClient() {
|
||||
protected HttpClient getClient() {
|
||||
if (client == null) {
|
||||
URI uri = URI.create(url);
|
||||
client = new DefaultHttpClient();
|
||||
client.getCredentialsProvider().setCredentials(
|
||||
new AuthScope(uri.getHost(), uri.getPort()),
|
||||
new UsernamePasswordCredentials(account.username, account.httpPassword));
|
||||
BasicCredentialsProvider creds = new BasicCredentialsProvider();
|
||||
creds.setCredentials(new AuthScope(uri.getHost(), uri.getPort()),
|
||||
new UsernamePasswordCredentials(account.username,
|
||||
account.httpPassword));
|
||||
client = HttpClientBuilder
|
||||
.create()
|
||||
.setDefaultCredentialsProvider(creds)
|
||||
.setMaxConnPerRoute(10)
|
||||
.setMaxConnTotal(1024)
|
||||
.build();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ maven_jar(
|
||||
|
||||
maven_jar(
|
||||
name = 'httpclient',
|
||||
id = 'org.apache.httpcomponents:httpclient:4.2.5',
|
||||
bin_sha1 = '666e26e76f2e87d84e4f16acb546481ae1b8e9a6',
|
||||
src_sha1 = '55d345272944d7e8dace47925336a3764ee0e24b',
|
||||
id = 'org.apache.httpcomponents:httpclient:4.3.4',
|
||||
bin_sha1 = 'a9a1fef2faefed639ee0d0fba5b3b8e4eb2ff2d8',
|
||||
src_sha1 = '7a14aafed8c5e2c4e360a2c1abd1602efa768b1f',
|
||||
license = 'Apache2.0',
|
||||
deps = [
|
||||
':codec',
|
||||
@ -106,16 +106,16 @@ maven_jar(
|
||||
|
||||
maven_jar(
|
||||
name = 'httpcore',
|
||||
id = 'org.apache.httpcomponents:httpcore:4.2.4',
|
||||
bin_sha1 = '3b7f38df6de5dd8b500e602ae8c2dd5ee446f883',
|
||||
src_sha1 = 'c3ffe3a73348645042fb0b06303b6a3de194494e',
|
||||
id = 'org.apache.httpcomponents:httpcore:4.3.2',
|
||||
bin_sha1 = '31fbbff1ddbf98f3aa7377c94d33b0447c646b6e',
|
||||
src_sha1 = '4809f38359edeea9487f747e09aa58ec8d3a54c5',
|
||||
license = 'Apache2.0',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'httpmime',
|
||||
id = 'org.apache.httpcomponents:httpmime:4.2.5',
|
||||
bin_sha1 = '412b9914d0adec6d5716df1ada8acbc4f6f2dd37',
|
||||
src_sha1 = 'c07ce7f6b153284a9ebaf58532c2442200cf3aa2',
|
||||
id = 'org.apache.httpcomponents:httpmime:4.3.4',
|
||||
bin_sha1 = '54ffde537682aea984c22fbcf0106f21397c5f9b',
|
||||
src_sha1 = '0651e21152b0963661068f948d84ed08c18094f8',
|
||||
license = 'Apache2.0',
|
||||
)
|
||||
|
@ -1,18 +1,18 @@
|
||||
include_defs('//lib/maven.defs')
|
||||
|
||||
VER = '1.7.6'
|
||||
VER = '1.7.7'
|
||||
|
||||
maven_jar(
|
||||
name = 'api',
|
||||
id = 'org.slf4j:slf4j-api:' + VER,
|
||||
sha1 = '562424e36df3d2327e8e9301a76027fca17d54ea',
|
||||
sha1 = '2b8019b6249bb05d81d3a3094e468753e2b21311',
|
||||
license = 'slf4j',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'impl_log4j',
|
||||
id = 'org.slf4j:slf4j-log4j12:' + VER,
|
||||
sha1 = '6953717b9850aeb26d1b8375ca07dbd9c50eca4e',
|
||||
sha1 = '58f588119ffd1702c77ccab6acb54bfb41bed8bd',
|
||||
license = 'slf4j',
|
||||
deps = [':log4j'],
|
||||
)
|
||||
@ -20,7 +20,7 @@ maven_jar(
|
||||
maven_jar(
|
||||
name = 'jcl-over-slf4j',
|
||||
id = 'org.slf4j:jcl-over-slf4j:' + VER,
|
||||
sha1 = 'ab1648fe1dd6f1e5c2ec6d12f394672bb8c1036a',
|
||||
sha1 = '56003dcd0a31deea6391b9e2ef2f2dc90b205a92',
|
||||
license = 'slf4j',
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user