Skip to content

Commit a2bcccf

Browse files
author
Stephane Landelle
committed
minor clean up
1 parent 2694692 commit a2bcccf

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

api/src/main/java/org/asynchttpclient/ProxyServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ProxyServer(final Protocol protocol, final String host, final int port, S
6666
this.port = port;
6767
this.principal = principal;
6868
this.password = password;
69-
this.uri = AsyncHttpProviderUtils.createUri(toString());
69+
this.uri = AsyncHttpProviderUtils.createNonEmptyPathURI(toString());
7070
}
7171

7272
public ProxyServer(final String host, final int port, String principal, String password) {

api/src/main/java/org/asynchttpclient/util/AsyncHttpProviderUtils.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static final void validateSupportedScheme(URI uri) {
4848
}
4949
}
5050

51-
public final static URI createUri(String u) {
51+
public final static URI createNonEmptyPathURI(String u) {
5252
URI uri = URI.create(u);
5353
validateSupportedScheme(uri);
5454

@@ -64,10 +64,6 @@ public final static URI createUri(String u) {
6464
return uri;
6565
}
6666

67-
public static String getBaseUrl(String url) {
68-
return getBaseUrl(createUri(url));
69-
}
70-
7167
public final static String getBaseUrl(URI uri) {
7268
String url = uri.getScheme() + "://" + uri.getAuthority();
7369
int port = uri.getPort();
@@ -202,8 +198,7 @@ public static String parseCharset(String contentType) {
202198
// Quite a lot of sites have charset="CHARSET",
203199
// e.g. charset="utf-8". Note the quotes. This is
204200
// not correct, but client should be able to handle
205-
// it (all browsers do, Apache HTTP Client and Grizzly
206-
// strip it by default)
201+
// it (all browsers do, Grizzly strips it by default)
207202
// This is a poor man's trim("\"").trim("'")
208203
return charset.replaceAll("\"", "").replaceAll("'", "");
209204
}
@@ -212,11 +207,6 @@ public static String parseCharset(String contentType) {
212207
return null;
213208
}
214209

215-
public static int secondsFromNow(long timeMillis) {
216-
long maxAgeMillis = timeMillis - System.currentTimeMillis();
217-
return (int) (maxAgeMillis / 1000) + (maxAgeMillis % 1000 != 0 ? 1 : 0);
218-
}
219-
220210
public static String keepAliveHeaderValue(AsyncHttpClientConfig config) {
221211
return config.getAllowPoolingConnection() ? "keep-alive" : "close";
222212
}

0 commit comments

Comments
 (0)