Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;

import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.NameValuePair;
Expand Down Expand Up @@ -1033,22 +1033,22 @@ public URIBuilder normalizeSyntax() {
if (this.pathSegments != null) {
final List<String> inputSegments = this.pathSegments;
if (!inputSegments.isEmpty()) {
final Stack<String> outputSegments = new Stack<>();
final LinkedList<String> outputSegments = new LinkedList<>();
Comment thread
michael-o marked this conversation as resolved.
for (final String inputSegment : inputSegments) {
if (!inputSegment.isEmpty() && !".".equals(inputSegment)) {
if ("..".equals(inputSegment)) {
if (!outputSegments.isEmpty()) {
outputSegments.pop();
outputSegments.removeLast();
}
} else {
outputSegments.push(inputSegment);
outputSegments.addLast(inputSegment);
}
}
}
if (!inputSegments.isEmpty()) {
final String lastSegment = inputSegments.get(inputSegments.size() - 1);
if (lastSegment.isEmpty()) {
outputSegments.push("");
outputSegments.addLast("");
}
}
this.pathSegments = outputSegments;
Expand Down