wleeaf commented on code in PR #904:
URL:
https://github.com/apache/httpcomponents-client/pull/904#discussion_r4376177323
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultRedirectStrategy.java:
##########
@@ -185,9 +185,11 @@ protected URI createLocationURI(final String location)
throws ProtocolException
final String host = b.getHost();
if (host != null) {
b.setHost(host.toLowerCase(Locale.ROOT));
- }
- if (b.isPathEmpty()) {
- b.setPathSegments("");
+ // Only an absolute URI gets an empty path replaced with "/".
A relative reference
Review Comment:
Right, the condition is `host != null`, which also covers a network-path
reference like `//example.com/path`. The comment now says "a location with an
authority (an absolute URI or "//host")" (11fd7a6).
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultRedirectStrategy.java:
##########
@@ -185,9 +185,11 @@ protected URI createLocationURI(final String location)
throws ProtocolException
final String host = b.getHost();
if (host != null) {
b.setHost(host.toLowerCase(Locale.ROOT));
- }
- if (b.isPathEmpty()) {
- b.setPathSegments("");
+ // Only an absolute URI gets an empty path replaced with "/".
A relative reference
Review Comment:
Right, the condition is `host != null`, which also covers a network-path
reference like `//example.com/path`. The comment now says "a location with an
authority (an absolute URI or "//host")" (fcb7587).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]