Skip to content

Commit 602a62f

Browse files
author
Sergey Pariev
committed
remove some chars from tokens per RFC, see http-parser.c commit 48a4364
1 parent 5963dee commit 602a62f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/impl/http_parser/lolevel/HTTPParser.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,11 @@ byte upper(byte b) {
14851485
}
14861486

14871487
byte token(byte b) {
1488-
return (byte)tokens[b];
1488+
if(!strict){
1489+
return (b == (byte)' ') ? (byte)' ' : (byte)tokens[b] ;
1490+
}else{
1491+
return (byte)tokens[b];
1492+
}
14891493
}
14901494

14911495

@@ -1738,9 +1742,9 @@ static class C {
17381742
/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */
17391743
0, 0, 0, 0, 0, 0, 0, 0,
17401744
/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */
1741-
' ', '!', '"', '#', '$', '%', '&', '\'',
1745+
0, '!', 0, '#', '$', '%', '&', '\'',
17421746
/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */
1743-
0, 0, '*', '+', 0, '-', '.', '/' ,
1747+
0, 0, '*', '+', 0, '-', '.', 0 ,
17441748
/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */
17451749
'0', '1', '2', '3', '4', '5', '6', '7',
17461750
/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */
@@ -1760,7 +1764,7 @@ static class C {
17601764
/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */
17611765
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
17621766
/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
1763-
'X', 'Y', 'Z', 0, '|', '}', 0, 0,
1767+
'X', 'Y', 'Z', 0, '|', 0, '~', 0,
17641768
/* hi bit set, not ascii */
17651769
0, 0, 0, 0, 0, 0, 0, 0,
17661770
0, 0, 0, 0, 0, 0, 0, 0,

src/test/http_parser/lolevel/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static void test_message(Message mes) {
5151

5252
HTTPParser parser = new HTTPParser(mes.type);
5353
ParserSettings settings = mes.settings();
54-
54+
5555
int read = 0;
5656
if (msg1len !=0) {
5757
read = parser.execute(settings, msg1);

0 commit comments

Comments
 (0)