Misc clean ups. (#200)
This commit is contained in:
parent
0812192f46
commit
071fa68a3c
|
@ -74,11 +74,10 @@ public final class ConnectExceptionSupport {
|
|||
final IOException ex = createConnectTimeoutException(cause, namedEndpoint, remoteAddresses);
|
||||
ex.initCause(cause);
|
||||
return ex;
|
||||
} else {
|
||||
final IOException ex = createHttpHostConnectException(cause, namedEndpoint, remoteAddresses);
|
||||
ex.setStackTrace(cause.getStackTrace());
|
||||
return ex;
|
||||
}
|
||||
final IOException ex = createHttpHostConnectException(cause, namedEndpoint, remoteAddresses);
|
||||
ex.setStackTrace(cause.getStackTrace());
|
||||
return ex;
|
||||
} else {
|
||||
return cause;
|
||||
}
|
||||
|
|
|
@ -213,9 +213,8 @@ public final class HttpRoute implements RouteInfo, Cloneable {
|
|||
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
|
||||
if (hop < hopcount - 1) {
|
||||
return this.proxyChain.get(hop);
|
||||
} else {
|
||||
return this.targetHost;
|
||||
}
|
||||
return this.targetHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,8 +67,7 @@ public class DecompressingEntity extends HttpEntityWrapper {
|
|||
}
|
||||
|
||||
private InputStream getDecompressingStream() throws IOException {
|
||||
final InputStream in = super.getContent();
|
||||
return new LazyDecompressingInputStream(in, inputStreamFactory);
|
||||
return new LazyDecompressingInputStream(super.getContent(), inputStreamFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,6 +51,7 @@ public class FormBodyPart extends MultipartPart {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addField(final String name, final String value) {
|
||||
Args.notNull(name, "Field name");
|
||||
super.addField(name, value);
|
||||
|
|
|
@ -77,9 +77,8 @@ public class DefaultRoutePlanner implements HttpRoutePlanner {
|
|||
final boolean secure = target.getSchemeName().equalsIgnoreCase("https");
|
||||
if (proxy == null) {
|
||||
return new HttpRoute(target, determineLocalAddress(target, context), secure);
|
||||
} else {
|
||||
return new HttpRoute(target, determineLocalAddress(proxy, context), proxy, secure);
|
||||
}
|
||||
return new HttpRoute(target, determineLocalAddress(proxy, context), proxy, secure);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,9 +106,8 @@ public final class PublicSuffixMatcher {
|
|||
final DomainType domainType = map.get(rule);
|
||||
if (domainType == null) {
|
||||
return false;
|
||||
} else {
|
||||
return expectedType == null || domainType.equals(expectedType);
|
||||
}
|
||||
return expectedType == null || domainType.equals(expectedType);
|
||||
}
|
||||
|
||||
private boolean hasRule(final String rule, final DomainType expectedType) {
|
||||
|
|
|
@ -51,18 +51,17 @@ public final class RoutingSupport {
|
|||
throw new ProtocolException("Protocol scheme is not specified");
|
||||
}
|
||||
return new HttpHost(scheme, authority);
|
||||
} else {
|
||||
try {
|
||||
final URI requestURI = request.getUri();
|
||||
if (requestURI.isAbsolute()) {
|
||||
final HttpHost httpHost = URIUtils.extractHost(requestURI);
|
||||
if (httpHost == null) {
|
||||
throw new ProtocolException("URI does not specify a valid host name: " + requestURI);
|
||||
}
|
||||
return httpHost;
|
||||
}
|
||||
try {
|
||||
final URI requestURI = request.getUri();
|
||||
if (requestURI.isAbsolute()) {
|
||||
final HttpHost httpHost = URIUtils.extractHost(requestURI);
|
||||
if (httpHost == null) {
|
||||
throw new ProtocolException("URI does not specify a valid host name: " + requestURI);
|
||||
}
|
||||
} catch (final URISyntaxException ignore) {
|
||||
return httpHost;
|
||||
}
|
||||
} catch (final URISyntaxException ignore) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -101,9 +101,8 @@ public class ConscryptClientTlsStrategy extends AbstractClientTlsStrategy {
|
|||
TlsDetails createTlsDetails(final SSLEngine sslEngine) {
|
||||
if (Conscrypt.isConscrypt(sslEngine)) {
|
||||
return new TlsDetails(sslEngine.getSession(), Conscrypt.getApplicationProtocol(sslEngine));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
|
|
|
@ -117,9 +117,8 @@ final class TlsSessionValidator {
|
|||
final ProtocolVersion tls = TLS.parse(sslsession.getProtocol());
|
||||
if (tls.greaterEquals(TLS.V_1_3.version)) {
|
||||
return;
|
||||
} else {
|
||||
throw ex;
|
||||
}
|
||||
throw ex;
|
||||
} catch (final ParseException ex2) {
|
||||
throw ex;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue