@@ -125,7 +125,7 @@ public State parse_url_char(byte ch) {
125125 if (isAtoZ (ch )){
126126 return req_schema ;
127127 }
128- if (SEMI == ch ){
128+ if (COLON == ch ){
129129 return req_schema_slash ;
130130 }
131131 break ;
@@ -1205,7 +1205,7 @@ public int execute(ParserSettings settings, ByteBuffer data) {
12051205 if (0 != (flags & F_TRAILING )) {
12061206 /* End of a chunked request */
12071207 state = new_message ();
1208-
1208+ settings . call_on_headers_complete ( this );
12091209 settings .call_on_message_complete (this );
12101210 break ;
12111211 }
@@ -1309,18 +1309,22 @@ public int execute(ParserSettings settings, ByteBuffer data) {
13091309 case body_identity :
13101310 //TODO apply changes from C version for s_body_identity
13111311 to_read = min (pe - p , content_length ); //TODO change to use buffer?
1312+ body_mark = p ;
13121313
1313- if (to_read > 0 ) {
1314- settings .call_on_body (this , data , p , to_read );
1315- data .position (p +to_read );
1316- content_length -= to_read ;
1317- if (content_length == 0 ) {
1318- settings .call_on_message_complete (this );
1319- state = new_message ();
1320- }
1314+ // if (to_read > 0) {
1315+ settings .call_on_body (this , data , p , to_read );
1316+ data .position (p +to_read );
1317+ content_length -= to_read ;
1318+
1319+ if (content_length == 0 ) {
1320+ state = message_done ;
1321+ settings .call_on_message_complete (this );
1322+ // state = new_message();
1323+ reexecute = true ;
13211324 }
1325+ // }
1326+
13221327
1323- reexecute = true ;
13241328 break ;
13251329
13261330
@@ -1336,7 +1340,7 @@ public int execute(ParserSettings settings, ByteBuffer data) {
13361340 case message_done :
13371341 state = new_message ();
13381342 settings .call_on_message_complete (this );
1339-
1343+ break ;
13401344 /******************* Body *******************/
13411345
13421346
@@ -1384,7 +1388,7 @@ public int execute(ParserSettings settings, ByteBuffer data) {
13841388
13851389 t *= 16 ;
13861390 t += c ;
1387- if (t < content_length || t == 0 ){
1391+ if (t < content_length || t == - 1 ){
13881392 return error (settings , "invalid content length" , data );
13891393 }
13901394 content_length = t ;
@@ -1576,9 +1580,9 @@ byte token(byte b) {
15761580
15771581 boolean isHostChar (byte ch ){
15781582 if (!strict ){
1579- return (isAtoZ (ch )) || DOT == ch || DASH == ch || UNDER == ch ;
1583+ return (isAtoZ (ch )) || isDigit ( ch ) || DOT == ch || DASH == ch || UNDER == ch ;
15801584 }else {
1581- return (isAtoZ (ch )) || DOT == ch || DASH == ch ;
1585+ return (isAtoZ (ch )) || isDigit ( ch ) || DOT == ch || DASH == ch ;
15821586 }
15831587 }
15841588
0 commit comments