"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java/org/apache/http/client/utils/URIUtils.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.

URIUtils.java  (httpcomponents-client-4.5.6-src):URIUtils.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 150 skipping to change at line 150
uribuilder.setHost(target.getHostName()); uribuilder.setHost(target.getHostName());
uribuilder.setPort(target.getPort()); uribuilder.setPort(target.getPort());
} else { } else {
uribuilder.setScheme(null); uribuilder.setScheme(null);
uribuilder.setHost(null); uribuilder.setHost(null);
uribuilder.setPort(-1); uribuilder.setPort(-1);
} }
if (dropFragment) { if (dropFragment) {
uribuilder.setFragment(null); uribuilder.setFragment(null);
} }
if (TextUtils.isEmpty(uribuilder.getPath())) { final String path = uribuilder.getPath();
if (TextUtils.isEmpty(path)) {
uribuilder.setPath("/"); uribuilder.setPath("/");
} else {
final StringBuilder buf = new StringBuilder(path.length());
boolean foundSlash = false;
for (int i = 0; i < path.length(); i++) {
final char ch = path.charAt(i);
if (ch != '/' || !foundSlash) {
buf.append(ch);
}
foundSlash = ch == '/';
}
uribuilder.setPath(buf.toString());
} }
return uribuilder.build(); return uribuilder.build();
} }
/** /**
* A convenience method for * A convenience method for
* {@link URIUtils#rewriteURI(URI, HttpHost, boolean)} that always keeps the * {@link URIUtils#rewriteURI(URI, HttpHost, boolean)} that always keeps the
* fragment. * fragment.
*/ */
public static URI rewriteURI( public static URI rewriteURI(
skipping to change at line 214 skipping to change at line 226
* If the resulting URI is invalid. * If the resulting URI is invalid.
* *
* @since 4.4 * @since 4.4
*/ */
public static URI rewriteURIForRoute(final URI uri, final RouteInfo route) t hrows URISyntaxException { public static URI rewriteURIForRoute(final URI uri, final RouteInfo route) t hrows URISyntaxException {
if (uri == null) { if (uri == null) {
return null; return null;
} }
if (route.getProxyHost() != null && !route.isTunnelled()) { if (route.getProxyHost() != null && !route.isTunnelled()) {
// Make sure the request URI is absolute // Make sure the request URI is absolute
if (!uri.isAbsolute()) { return uri.isAbsolute()
final HttpHost target = route.getTargetHost(); ? rewriteURI(uri)
return rewriteURI(uri, target, true); : rewriteURI(uri, route.getTargetHost(), true);
} else {
return rewriteURI(uri);
}
} else {
// Make sure the request URI is relative
if (uri.isAbsolute()) {
return rewriteURI(uri, null, true);
} else {
return rewriteURI(uri);
}
} }
// Make sure the request URI is relative
return uri.isAbsolute() ? rewriteURI(uri, null, true) : rewriteURI(uri);
} }
/** /**
* Resolves a URI reference against a base URI. Work-around for bug in * Resolves a URI reference against a base URI. Work-around for bug in
* java.net.URI (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535) * java.net.URI (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535)
* *
* @param baseURI the base URI * @param baseURI the base URI
* @param reference the URI reference * @param reference the URI reference
* @return the resulting URI * @return the resulting URI
*/ */
 End of changes. 4 change blocks. 
14 lines changed or deleted 18 lines changed or added

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