Only add / to uri if really needed.
Motivation: We not need to include the start index in the check. See https://github.com/netty/netty/pull/6924#discussion_r125263918 Modifications: Change <= to < Result: More correct code.
This commit is contained in:
parent
e6a399a778
commit
f1e14d0cb2
@ -56,11 +56,11 @@ public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
|
|||||||
// See https://github.com/netty/netty/issues/2732
|
// See https://github.com/netty/netty/issues/2732
|
||||||
int index = uri.indexOf(QUESTION_MARK, start);
|
int index = uri.indexOf(QUESTION_MARK, start);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
if (uri.lastIndexOf(SLASH) <= start) {
|
if (uri.lastIndexOf(SLASH) < start) {
|
||||||
needSlash = true;
|
needSlash = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (uri.lastIndexOf(SLASH, index) <= start) {
|
if (uri.lastIndexOf(SLASH, index) < start) {
|
||||||
uriCharSequence = new StringBuilder(uri).insert(index, SLASH);
|
uriCharSequence = new StringBuilder(uri).insert(index, SLASH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user