Lines Matching refs:parser

34     if (0 != settings->on_##FOR(parser)) return (p - data);          \
48 if (0 != settings->on_##FOR(parser, \
198 #define PARSING_HEADER(state) (state <= s_headers_almost_done && 0 == (parser->flags & F_TRAILING))
244 #define start_state (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
249 # define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
256 size_t php_http_parser_execute (php_http_parser *parser, in php_http_parser_execute() argument
266 enum state state = (enum state) parser->state; in php_http_parser_execute()
267 enum header_states header_state = (enum header_states) parser->header_state; in php_http_parser_execute()
268 uint32_t index = parser->index; in php_http_parser_execute()
269 uint32_t nread = parser->nread; in php_http_parser_execute()
326 parser->flags = 0; in php_http_parser_execute()
327 parser->content_length = -1; in php_http_parser_execute()
334 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
342 parser->type = PHP_HTTP_RESPONSE; in php_http_parser_execute()
346 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
347 parser->method = PHP_HTTP_HEAD; in php_http_parser_execute()
355 parser->flags = 0; in php_http_parser_execute()
356 parser->content_length = -1; in php_http_parser_execute()
397 parser->http_major = ch - '0'; in php_http_parser_execute()
411 parser->http_major *= 10; in php_http_parser_execute()
412 parser->http_major += ch - '0'; in php_http_parser_execute()
414 if (parser->http_major > 999) goto error; in php_http_parser_execute()
421 parser->http_minor = ch - '0'; in php_http_parser_execute()
435 parser->http_minor *= 10; in php_http_parser_execute()
436 parser->http_minor += ch - '0'; in php_http_parser_execute()
438 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
450 parser->status_code = ch - '0'; in php_http_parser_execute()
474 parser->status_code *= 10; in php_http_parser_execute()
475 parser->status_code += ch - '0'; in php_http_parser_execute()
477 if (parser->status_code > 999) goto error; in php_http_parser_execute()
504 parser->flags = 0; in php_http_parser_execute()
505 parser->content_length = -1; in php_http_parser_execute()
512 parser->method = (enum php_http_method) 0; in php_http_parser_execute()
515 case 'C': parser->method = PHP_HTTP_CONNECT; /* or COPY, CHECKOUT */ break; in php_http_parser_execute()
516 case 'D': parser->method = PHP_HTTP_DELETE; break; in php_http_parser_execute()
517 case 'G': parser->method = PHP_HTTP_GET; break; in php_http_parser_execute()
518 case 'H': parser->method = PHP_HTTP_HEAD; break; in php_http_parser_execute()
519 case 'L': parser->method = PHP_HTTP_LOCK; break; in php_http_parser_execute()
520 …case 'M': parser->method = PHP_HTTP_MKCOL; /* or MOVE, MKCALENDAR, MKACTIVITY, MERGE, M-SEARCH */ … in php_http_parser_execute()
521 case 'N': parser->method = PHP_HTTP_NOTIFY; break; in php_http_parser_execute()
522 case 'O': parser->method = PHP_HTTP_OPTIONS; break; in php_http_parser_execute()
523 case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break; in php_http_parser_execute()
524 case 'R': parser->method = PHP_HTTP_REPORT; break; in php_http_parser_execute()
525 case 'S': parser->method = PHP_HTTP_SUBSCRIBE; /* or SEARCH */ break; in php_http_parser_execute()
526 case 'T': parser->method = PHP_HTTP_TRACE; break; in php_http_parser_execute()
527 case 'U': parser->method = PHP_HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; in php_http_parser_execute()
528 default: parser->method = PHP_HTTP_NOT_IMPLEMENTED; break; in php_http_parser_execute()
539 matcher = method_strings[parser->method]; in php_http_parser_execute()
541 if (parser->method != PHP_HTTP_NOT_IMPLEMENTED && matcher[index] != '\0') { in php_http_parser_execute()
542 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
545 } else if (parser->method == PHP_HTTP_NOT_IMPLEMENTED || ch == matcher[index]) { in php_http_parser_execute()
547 } else if (parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
549 parser->method = PHP_HTTP_CHECKOUT; in php_http_parser_execute()
551 parser->method = PHP_HTTP_COPY; in php_http_parser_execute()
553 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
555 } else if (parser->method == PHP_HTTP_MKCOL) { in php_http_parser_execute()
557 parser->method = PHP_HTTP_MOVE; in php_http_parser_execute()
559 parser->method = PHP_HTTP_MKCALENDAR; in php_http_parser_execute()
561 parser->method = PHP_HTTP_MERGE; in php_http_parser_execute()
563 parser->method = PHP_HTTP_MSEARCH; in php_http_parser_execute()
565 parser->method = PHP_HTTP_MKACTIVITY; in php_http_parser_execute()
567 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
569 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'R') { in php_http_parser_execute()
570 parser->method = PHP_HTTP_PROPFIND; /* or HTTP_PROPPATCH */ in php_http_parser_execute()
571 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'U') { in php_http_parser_execute()
572 parser->method = PHP_HTTP_PUT; in php_http_parser_execute()
573 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'A') { in php_http_parser_execute()
574 parser->method = PHP_HTTP_PATCH; in php_http_parser_execute()
575 } else if (index == 1 && parser->method == PHP_HTTP_SUBSCRIBE && ch == 'E') { in php_http_parser_execute()
576 parser->method = PHP_HTTP_SEARCH; in php_http_parser_execute()
577 } else if (index == 2 && parser->method == PHP_HTTP_UNLOCK && ch == 'S') { in php_http_parser_execute()
578 parser->method = PHP_HTTP_UNSUBSCRIBE; in php_http_parser_execute()
579 } else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') { in php_http_parser_execute()
580 parser->method = PHP_HTTP_PROPPATCH; in php_http_parser_execute()
582 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
702 parser->http_major = 0; in php_http_parser_execute()
703 parser->http_minor = 9; in php_http_parser_execute()
709 parser->http_major = 0; in php_http_parser_execute()
710 parser->http_minor = 9; in php_http_parser_execute()
744 parser->http_major = 0; in php_http_parser_execute()
745 parser->http_minor = 9; in php_http_parser_execute()
750 parser->http_major = 0; in php_http_parser_execute()
751 parser->http_minor = 9; in php_http_parser_execute()
779 parser->http_major = 0; in php_http_parser_execute()
780 parser->http_minor = 9; in php_http_parser_execute()
786 parser->http_major = 0; in php_http_parser_execute()
787 parser->http_minor = 9; in php_http_parser_execute()
815 parser->http_major = 0; in php_http_parser_execute()
816 parser->http_minor = 9; in php_http_parser_execute()
821 parser->http_major = 0; in php_http_parser_execute()
822 parser->http_minor = 9; in php_http_parser_execute()
850 parser->http_major = 0; in php_http_parser_execute()
851 parser->http_minor = 9; in php_http_parser_execute()
857 parser->http_major = 0; in php_http_parser_execute()
858 parser->http_minor = 9; in php_http_parser_execute()
905 parser->http_major = ch - '0'; in php_http_parser_execute()
919 parser->http_major *= 10; in php_http_parser_execute()
920 parser->http_major += ch - '0'; in php_http_parser_execute()
922 if (parser->http_major > 999) goto error; in php_http_parser_execute()
929 parser->http_minor = ch - '0'; in php_http_parser_execute()
950 parser->http_minor *= 10; in php_http_parser_execute()
951 parser->http_minor += ch - '0'; in php_http_parser_execute()
953 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
1167 parser->flags |= F_UPGRADE; in php_http_parser_execute()
1182 parser->content_length = ch - '0'; in php_http_parser_execute()
1231 parser->content_length *= 10; in php_http_parser_execute()
1232 parser->content_length += ch - '0'; in php_http_parser_execute()
1290 parser->flags |= F_CONNECTION_KEEP_ALIVE; in php_http_parser_execute()
1293 parser->flags |= F_CONNECTION_CLOSE; in php_http_parser_execute()
1296 parser->flags |= F_CHUNKED; in php_http_parser_execute()
1309 if (parser->flags & F_TRAILING) { in php_http_parser_execute()
1318 if (parser->flags & F_UPGRADE || parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
1319 parser->upgrade = 1; in php_http_parser_execute()
1329 switch (settings->on_headers_complete(parser)) { in php_http_parser_execute()
1334 parser->flags |= F_SKIPBODY; in php_http_parser_execute()
1343 if (parser->upgrade) { in php_http_parser_execute()
1348 if (parser->flags & F_SKIPBODY) { in php_http_parser_execute()
1351 } else if (parser->flags & F_CHUNKED) { in php_http_parser_execute()
1355 if (parser->content_length == 0) { in php_http_parser_execute()
1359 } else if (parser->content_length > 0) { in php_http_parser_execute()
1363 if (parser->type == PHP_HTTP_REQUEST || php_http_should_keep_alive(parser)) { in php_http_parser_execute()
1380 to_read = MIN((size_t)(pe - p), (size_t)parser->content_length); in php_http_parser_execute()
1382 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1384 parser->content_length -= to_read; in php_http_parser_execute()
1385 if (parser->content_length == 0) { in php_http_parser_execute()
1396 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1403 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1407 parser->content_length = c; in php_http_parser_execute()
1414 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1431 parser->content_length *= 16; in php_http_parser_execute()
1432 parser->content_length += c; in php_http_parser_execute()
1438 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1449 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1452 if (parser->content_length == 0) { in php_http_parser_execute()
1453 parser->flags |= F_TRAILING; in php_http_parser_execute()
1463 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1466 to_read = MIN((size_t)(pe - p), (size_t)(parser->content_length)); in php_http_parser_execute()
1469 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1473 if (to_read == (size_t)parser->content_length) { in php_http_parser_execute()
1477 parser->content_length -= to_read; in php_http_parser_execute()
1482 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1488 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1506 parser->state = state; in php_http_parser_execute()
1507 parser->header_state = header_state; in php_http_parser_execute()
1508 parser->index = index; in php_http_parser_execute()
1509 parser->nread = nread; in php_http_parser_execute()
1514 parser->state = s_dead; in php_http_parser_execute()
1520 php_http_should_keep_alive (php_http_parser *parser) in php_http_should_keep_alive() argument
1522 if (parser->http_major > 0 && parser->http_minor > 0) { in php_http_should_keep_alive()
1524 if (parser->flags & F_CONNECTION_CLOSE) { in php_http_should_keep_alive()
1531 if (parser->flags & F_CONNECTION_KEEP_ALIVE) { in php_http_should_keep_alive()
1547 php_http_parser_init (php_http_parser *parser, enum php_http_parser_type t) in php_http_parser_init() argument
1549 parser->type = t; in php_http_parser_init()
1550parser->state = (t == PHP_HTTP_REQUEST ? s_start_req : (t == PHP_HTTP_RESPONSE ? s_start_res : s_s… in php_http_parser_init()
1551 parser->nread = 0; in php_http_parser_init()
1552 parser->upgrade = 0; in php_http_parser_init()
1553 parser->flags = 0; in php_http_parser_init()
1554 parser->method = 0; in php_http_parser_init()