File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/main/java/io/vertx/core/http/impl Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 19
19
import io .netty .handler .codec .http2 .Http2Settings ;
20
20
import io .netty .util .AsciiString ;
21
21
import io .netty .util .CharsetUtil ;
22
+ import io .netty .util .internal .PlatformDependent ;
22
23
import io .vertx .core .AsyncResult ;
23
24
import io .vertx .core .Future ;
24
25
import io .vertx .core .Handler ;
@@ -882,7 +883,9 @@ private static void validateAsciiHeaderValue(AsciiString value) {
882
883
int off = value .arrayOffset ();
883
884
int end = off + length ;
884
885
885
- for (int index = off ; index < end ; index ++) {
886
+ // DON'T REMOVE 'off == 0? 0 : off' as it's a micro-optimization to reduce the range checks
887
+ // since AsciiString(s) often (if not always) have offset == 0
888
+ for (int index = off == 0 ? 0 : off ; index < end ; index ++) {
886
889
int latinChar = asciiChars [index ] & 0xFF ;
887
890
if (latinChar == 0x7F ) {
888
891
throw new IllegalArgumentException ("a header value contains a prohibited character '127': " + value );
You can’t perform that action at this time.
0 commit comments