Lines Matching refs:parser

34     if (0 != settings->on_##FOR(parser)) return (p - data);          \
48 if (0 != settings->on_##FOR(parser, \
266 #define PARSING_HEADER(state) (state <= s_headers_almost_done && 0 == (parser->flags & F_TRAILING))
312 #define start_state (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
317 # define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
324 size_t php_http_parser_execute (php_http_parser *parser, in php_http_parser_execute() argument
333 enum state state = (enum state) parser->state; in php_http_parser_execute()
334 enum header_states header_state = (enum header_states) parser->header_state; in php_http_parser_execute()
335 uint32_t index = parser->index; in php_http_parser_execute()
336 uint32_t nread = parser->nread; in php_http_parser_execute()
393 parser->flags = 0; in php_http_parser_execute()
394 parser->content_length = -1; in php_http_parser_execute()
401 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
409 parser->type = PHP_HTTP_RESPONSE; in php_http_parser_execute()
413 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
414 parser->method = PHP_HTTP_HEAD; in php_http_parser_execute()
422 parser->flags = 0; in php_http_parser_execute()
423 parser->content_length = -1; in php_http_parser_execute()
464 parser->http_major = ch - '0'; in php_http_parser_execute()
478 parser->http_major *= 10; in php_http_parser_execute()
479 parser->http_major += ch - '0'; in php_http_parser_execute()
481 if (parser->http_major > 999) goto error; in php_http_parser_execute()
488 parser->http_minor = ch - '0'; in php_http_parser_execute()
502 parser->http_minor *= 10; in php_http_parser_execute()
503 parser->http_minor += ch - '0'; in php_http_parser_execute()
505 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
517 parser->status_code = ch - '0'; in php_http_parser_execute()
541 parser->status_code *= 10; in php_http_parser_execute()
542 parser->status_code += ch - '0'; in php_http_parser_execute()
544 if (parser->status_code > 999) goto error; in php_http_parser_execute()
571 parser->flags = 0; in php_http_parser_execute()
572 parser->content_length = -1; in php_http_parser_execute()
579 parser->method = (enum php_http_method) 0; in php_http_parser_execute()
582 case 'C': parser->method = PHP_HTTP_CONNECT; /* or COPY, CHECKOUT */ break; in php_http_parser_execute()
583 case 'D': parser->method = PHP_HTTP_DELETE; break; in php_http_parser_execute()
584 case 'G': parser->method = PHP_HTTP_GET; break; in php_http_parser_execute()
585 case 'H': parser->method = PHP_HTTP_HEAD; break; in php_http_parser_execute()
586 case 'L': parser->method = PHP_HTTP_LOCK; break; in php_http_parser_execute()
587 …case 'M': parser->method = PHP_HTTP_MKCOL; /* or MOVE, MKCALENDAR, MKACTIVITY, MERGE, M-SEARCH */ … in php_http_parser_execute()
588 case 'N': parser->method = PHP_HTTP_NOTIFY; break; in php_http_parser_execute()
589 case 'O': parser->method = PHP_HTTP_OPTIONS; break; in php_http_parser_execute()
590 case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break; in php_http_parser_execute()
591 case 'R': parser->method = PHP_HTTP_REPORT; break; in php_http_parser_execute()
592 case 'S': parser->method = PHP_HTTP_SUBSCRIBE; break; in php_http_parser_execute()
593 case 'T': parser->method = PHP_HTTP_TRACE; break; in php_http_parser_execute()
594 case 'U': parser->method = PHP_HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; in php_http_parser_execute()
595 default: parser->method = PHP_HTTP_NOT_IMPLEMENTED; break; in php_http_parser_execute()
607 matcher = method_strings[parser->method]; in php_http_parser_execute()
609 if (parser->method != PHP_HTTP_NOT_IMPLEMENTED && matcher[index] != '\0') { in php_http_parser_execute()
610 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
613 } else if (parser->method == PHP_HTTP_NOT_IMPLEMENTED || ch == matcher[index]) { in php_http_parser_execute()
615 } else if (parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
617 parser->method = PHP_HTTP_CHECKOUT; in php_http_parser_execute()
619 parser->method = PHP_HTTP_COPY; in php_http_parser_execute()
621 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
623 } else if (parser->method == PHP_HTTP_MKCOL) { in php_http_parser_execute()
625 parser->method = PHP_HTTP_MOVE; in php_http_parser_execute()
627 parser->method = PHP_HTTP_MKCALENDAR; in php_http_parser_execute()
629 parser->method = PHP_HTTP_MERGE; in php_http_parser_execute()
631 parser->method = PHP_HTTP_MSEARCH; in php_http_parser_execute()
633 parser->method = PHP_HTTP_MKACTIVITY; in php_http_parser_execute()
635 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
637 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'R') { in php_http_parser_execute()
638 parser->method = PHP_HTTP_PROPFIND; /* or HTTP_PROPPATCH */ in php_http_parser_execute()
639 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'U') { in php_http_parser_execute()
640 parser->method = PHP_HTTP_PUT; in php_http_parser_execute()
641 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'A') { in php_http_parser_execute()
642 parser->method = PHP_HTTP_PATCH; in php_http_parser_execute()
643 } else if (index == 2 && parser->method == PHP_HTTP_UNLOCK && ch == 'S') { in php_http_parser_execute()
644 parser->method = PHP_HTTP_UNSUBSCRIBE; in php_http_parser_execute()
645 } else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') { in php_http_parser_execute()
646 parser->method = PHP_HTTP_PROPPATCH; in php_http_parser_execute()
648 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
768 parser->http_major = 0; in php_http_parser_execute()
769 parser->http_minor = 9; in php_http_parser_execute()
775 parser->http_major = 0; in php_http_parser_execute()
776 parser->http_minor = 9; in php_http_parser_execute()
810 parser->http_major = 0; in php_http_parser_execute()
811 parser->http_minor = 9; in php_http_parser_execute()
816 parser->http_major = 0; in php_http_parser_execute()
817 parser->http_minor = 9; in php_http_parser_execute()
845 parser->http_major = 0; in php_http_parser_execute()
846 parser->http_minor = 9; in php_http_parser_execute()
852 parser->http_major = 0; in php_http_parser_execute()
853 parser->http_minor = 9; in php_http_parser_execute()
881 parser->http_major = 0; in php_http_parser_execute()
882 parser->http_minor = 9; in php_http_parser_execute()
887 parser->http_major = 0; in php_http_parser_execute()
888 parser->http_minor = 9; in php_http_parser_execute()
916 parser->http_major = 0; in php_http_parser_execute()
917 parser->http_minor = 9; in php_http_parser_execute()
923 parser->http_major = 0; in php_http_parser_execute()
924 parser->http_minor = 9; in php_http_parser_execute()
971 parser->http_major = ch - '0'; in php_http_parser_execute()
985 parser->http_major *= 10; in php_http_parser_execute()
986 parser->http_major += ch - '0'; in php_http_parser_execute()
988 if (parser->http_major > 999) goto error; in php_http_parser_execute()
995 parser->http_minor = ch - '0'; in php_http_parser_execute()
1016 parser->http_minor *= 10; in php_http_parser_execute()
1017 parser->http_minor += ch - '0'; in php_http_parser_execute()
1019 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
1233 parser->flags |= F_UPGRADE; in php_http_parser_execute()
1248 parser->content_length = ch - '0'; in php_http_parser_execute()
1297 parser->content_length *= 10; in php_http_parser_execute()
1298 parser->content_length += ch - '0'; in php_http_parser_execute()
1356 parser->flags |= F_CONNECTION_KEEP_ALIVE; in php_http_parser_execute()
1359 parser->flags |= F_CONNECTION_CLOSE; in php_http_parser_execute()
1362 parser->flags |= F_CHUNKED; in php_http_parser_execute()
1375 if (parser->flags & F_TRAILING) { in php_http_parser_execute()
1384 if (parser->flags & F_UPGRADE || parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
1385 parser->upgrade = 1; in php_http_parser_execute()
1395 switch (settings->on_headers_complete(parser)) { in php_http_parser_execute()
1400 parser->flags |= F_SKIPBODY; in php_http_parser_execute()
1409 if (parser->upgrade) { in php_http_parser_execute()
1414 if (parser->flags & F_SKIPBODY) { in php_http_parser_execute()
1417 } else if (parser->flags & F_CHUNKED) { in php_http_parser_execute()
1421 if (parser->content_length == 0) { in php_http_parser_execute()
1425 } else if (parser->content_length > 0) { in php_http_parser_execute()
1429 if (parser->type == PHP_HTTP_REQUEST || php_http_should_keep_alive(parser)) { in php_http_parser_execute()
1444 to_read = MIN(pe - p, (size_t)parser->content_length); in php_http_parser_execute()
1446 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1448 parser->content_length -= to_read; in php_http_parser_execute()
1449 if (parser->content_length == 0) { in php_http_parser_execute()
1460 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1467 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1471 parser->content_length = c; in php_http_parser_execute()
1478 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1495 parser->content_length *= 16; in php_http_parser_execute()
1496 parser->content_length += c; in php_http_parser_execute()
1502 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1513 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1516 if (parser->content_length == 0) { in php_http_parser_execute()
1517 parser->flags |= F_TRAILING; in php_http_parser_execute()
1527 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1529 to_read = MIN(pe - p, (size_t)(parser->content_length)); in php_http_parser_execute()
1532 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1536 if (to_read == parser->content_length) { in php_http_parser_execute()
1540 parser->content_length -= to_read; in php_http_parser_execute()
1545 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1551 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1569 parser->state = state; in php_http_parser_execute()
1570 parser->header_state = header_state; in php_http_parser_execute()
1571 parser->index = index; in php_http_parser_execute()
1572 parser->nread = nread; in php_http_parser_execute()
1577 parser->state = s_dead; in php_http_parser_execute()
1583 php_http_should_keep_alive (php_http_parser *parser) in php_http_should_keep_alive() argument
1585 if (parser->http_major > 0 && parser->http_minor > 0) { in php_http_should_keep_alive()
1587 if (parser->flags & F_CONNECTION_CLOSE) { in php_http_should_keep_alive()
1594 if (parser->flags & F_CONNECTION_KEEP_ALIVE) { in php_http_should_keep_alive()
1610 php_http_parser_init (php_http_parser *parser, enum php_http_parser_type t) in php_http_parser_init() argument
1612 parser->type = t; in php_http_parser_init()
1613parser->state = (t == PHP_HTTP_REQUEST ? s_start_req : (t == PHP_HTTP_RESPONSE ? s_start_res : s_s… in php_http_parser_init()
1614 parser->nread = 0; in php_http_parser_init()
1615 parser->upgrade = 0; in php_http_parser_init()
1616 parser->flags = 0; in php_http_parser_init()
1617 parser->method = 0; in php_http_parser_init()