"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java" between
httpcomponents-client-4.5.6-src.tar.gz and httpcomponents-client-4.5.7-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

HttpRoute.java  (httpcomponents-client-4.5.6-src):HttpRoute.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 106 skipping to change at line 106
} else { } else {
return -1; return -1;
} }
} }
//TODO: to be removed in 5.0 //TODO: to be removed in 5.0
private static HttpHost normalize(final HttpHost target) { private static HttpHost normalize(final HttpHost target) {
if (target.getPort() >= 0 ) { if (target.getPort() >= 0 ) {
return target; return target;
} else {
final InetAddress address = target.getAddress();
final String schemeName = target.getSchemeName();
if (address != null) {
return new HttpHost(address, getDefaultPort(schemeName), schemeN
ame);
} else {
final String hostName = target.getHostName();
return new HttpHost(hostName, getDefaultPort(schemeName), scheme
Name);
}
} }
final InetAddress address = target.getAddress();
final String schemeName = target.getSchemeName();
return address != null
? new HttpHost(address, getDefaultPort(schemeName), sche
meName)
: new HttpHost(target.getHostName(), getDefaultPort(sche
meName),
schemeName);
} }
/** /**
* Creates a new route with all attributes specified explicitly. * Creates a new route with all attributes specified explicitly.
* *
* @param target the host to which to route * @param target the host to which to route
* @param local the local address to route from, or * @param local the local address to route from, or
* {@code null} for the default * {@code null} for the default
* @param proxies the proxy chain to use, or * @param proxies the proxy chain to use, or
* {@code null} for a direct route * {@code null} for a direct route
skipping to change at line 241 skipping to change at line 238
@Override @Override
public final int getHopCount() { public final int getHopCount() {
return proxyChain != null ? proxyChain.size() + 1 : 1; return proxyChain != null ? proxyChain.size() + 1 : 1;
} }
@Override @Override
public final HttpHost getHopTarget(final int hop) { public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index"); Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount(); final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length"); Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) { return hop < hopcount - 1 ? this.proxyChain.get(hop) : this.targetHost;
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
} }
@Override @Override
public final HttpHost getProxyHost() { public final HttpHost getProxyHost() {
return proxyChain != null && !this.proxyChain.isEmpty() ? this.proxyChai n.get(0) : null; return proxyChain != null && !this.proxyChain.isEmpty() ? this.proxyChai n.get(0) : null;
} }
@Override @Override
public final TunnelType getTunnelType() { public final TunnelType getTunnelType() {
return this.tunnelled; return this.tunnelled;
skipping to change at line 301 skipping to change at line 294
if (obj instanceof HttpRoute) { if (obj instanceof HttpRoute) {
final HttpRoute that = (HttpRoute) obj; final HttpRoute that = (HttpRoute) obj;
return return
// Do the cheapest tests first // Do the cheapest tests first
(this.secure == that.secure) && (this.secure == that.secure) &&
(this.tunnelled == that.tunnelled) && (this.tunnelled == that.tunnelled) &&
(this.layered == that.layered) && (this.layered == that.layered) &&
LangUtils.equals(this.targetHost, that.targetHost) && LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) && LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain); LangUtils.equals(this.proxyChain, that.proxyChain);
} else {
return false;
} }
return false;
} }
/** /**
* Generates a hash code for this route. * Generates a hash code for this route.
* *
* @return the hash code * @return the hash code
*/ */
@Override @Override
public final int hashCode() { public final int hashCode() {
int hash = LangUtils.HASH_SEED; int hash = LangUtils.HASH_SEED;
 End of changes. 5 change blocks. 
18 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)