Lines Matching refs:parser

34     if (0 != settings->on_##FOR(parser)) return (p - data);          \
48 if (0 != settings->on_##FOR(parser, \
265 #define PARSING_HEADER(state) (state <= s_headers_almost_done && 0 == (parser->flags & F_TRAILING))
311 #define start_state (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
316 # define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
323 size_t php_http_parser_execute (php_http_parser *parser, in php_http_parser_execute() argument
332 enum state state = (enum state) parser->state; in php_http_parser_execute()
333 enum header_states header_state = (enum header_states) parser->header_state; in php_http_parser_execute()
334 uint32_t index = parser->index; in php_http_parser_execute()
335 uint32_t nread = parser->nread; in php_http_parser_execute()
392 parser->flags = 0; in php_http_parser_execute()
393 parser->content_length = -1; in php_http_parser_execute()
400 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
408 parser->type = PHP_HTTP_RESPONSE; in php_http_parser_execute()
412 parser->type = PHP_HTTP_REQUEST; in php_http_parser_execute()
413 parser->method = PHP_HTTP_HEAD; in php_http_parser_execute()
421 parser->flags = 0; in php_http_parser_execute()
422 parser->content_length = -1; in php_http_parser_execute()
463 parser->http_major = ch - '0'; in php_http_parser_execute()
477 parser->http_major *= 10; in php_http_parser_execute()
478 parser->http_major += ch - '0'; in php_http_parser_execute()
480 if (parser->http_major > 999) goto error; in php_http_parser_execute()
487 parser->http_minor = ch - '0'; in php_http_parser_execute()
501 parser->http_minor *= 10; in php_http_parser_execute()
502 parser->http_minor += ch - '0'; in php_http_parser_execute()
504 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
516 parser->status_code = ch - '0'; in php_http_parser_execute()
540 parser->status_code *= 10; in php_http_parser_execute()
541 parser->status_code += ch - '0'; in php_http_parser_execute()
543 if (parser->status_code > 999) goto error; in php_http_parser_execute()
570 parser->flags = 0; in php_http_parser_execute()
571 parser->content_length = -1; in php_http_parser_execute()
578 parser->method = (enum php_http_method) 0; in php_http_parser_execute()
581 case 'C': parser->method = PHP_HTTP_CONNECT; /* or COPY, CHECKOUT */ break; in php_http_parser_execute()
582 case 'D': parser->method = PHP_HTTP_DELETE; break; in php_http_parser_execute()
583 case 'G': parser->method = PHP_HTTP_GET; break; in php_http_parser_execute()
584 case 'H': parser->method = PHP_HTTP_HEAD; break; in php_http_parser_execute()
585 case 'L': parser->method = PHP_HTTP_LOCK; break; in php_http_parser_execute()
586 … case 'M': parser->method = PHP_HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break; in php_http_parser_execute()
587 case 'N': parser->method = PHP_HTTP_NOTIFY; break; in php_http_parser_execute()
588 case 'O': parser->method = PHP_HTTP_OPTIONS; break; in php_http_parser_execute()
589 case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break; in php_http_parser_execute()
590 case 'R': parser->method = PHP_HTTP_REPORT; break; in php_http_parser_execute()
591 case 'S': parser->method = PHP_HTTP_SUBSCRIBE; break; in php_http_parser_execute()
592 case 'T': parser->method = PHP_HTTP_TRACE; break; in php_http_parser_execute()
593 case 'U': parser->method = PHP_HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; in php_http_parser_execute()
594 default: parser->method = PHP_HTTP_NOT_IMPLEMENTED; break; in php_http_parser_execute()
606 matcher = method_strings[parser->method]; in php_http_parser_execute()
607 if (ch == ' ' && (matcher[index] == '\0' || parser->method == PHP_HTTP_NOT_IMPLEMENTED)) { in php_http_parser_execute()
611 } else if (parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
613 parser->method = PHP_HTTP_CHECKOUT; in php_http_parser_execute()
615 parser->method = PHP_HTTP_COPY; in php_http_parser_execute()
617 } else if (parser->method == PHP_HTTP_MKCOL) { in php_http_parser_execute()
619 parser->method = PHP_HTTP_MOVE; in php_http_parser_execute()
621 parser->method = PHP_HTTP_MERGE; in php_http_parser_execute()
623 parser->method = PHP_HTTP_MSEARCH; in php_http_parser_execute()
625 parser->method = PHP_HTTP_MKACTIVITY; in php_http_parser_execute()
627 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'R') { in php_http_parser_execute()
628 parser->method = PHP_HTTP_PROPFIND; /* or HTTP_PROPPATCH */ in php_http_parser_execute()
629 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'U') { in php_http_parser_execute()
630 parser->method = PHP_HTTP_PUT; in php_http_parser_execute()
631 } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'A') { in php_http_parser_execute()
632 parser->method = PHP_HTTP_PATCH; in php_http_parser_execute()
633 } else if (index == 2 && parser->method == PHP_HTTP_UNLOCK && ch == 'S') { in php_http_parser_execute()
634 parser->method = PHP_HTTP_UNSUBSCRIBE; in php_http_parser_execute()
635 } else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') { in php_http_parser_execute()
636 parser->method = PHP_HTTP_PROPPATCH; in php_http_parser_execute()
638 parser->method = PHP_HTTP_NOT_IMPLEMENTED; in php_http_parser_execute()
758 parser->http_major = 0; in php_http_parser_execute()
759 parser->http_minor = 9; in php_http_parser_execute()
765 parser->http_major = 0; in php_http_parser_execute()
766 parser->http_minor = 9; in php_http_parser_execute()
800 parser->http_major = 0; in php_http_parser_execute()
801 parser->http_minor = 9; in php_http_parser_execute()
806 parser->http_major = 0; in php_http_parser_execute()
807 parser->http_minor = 9; in php_http_parser_execute()
835 parser->http_major = 0; in php_http_parser_execute()
836 parser->http_minor = 9; in php_http_parser_execute()
842 parser->http_major = 0; in php_http_parser_execute()
843 parser->http_minor = 9; in php_http_parser_execute()
871 parser->http_major = 0; in php_http_parser_execute()
872 parser->http_minor = 9; in php_http_parser_execute()
877 parser->http_major = 0; in php_http_parser_execute()
878 parser->http_minor = 9; in php_http_parser_execute()
906 parser->http_major = 0; in php_http_parser_execute()
907 parser->http_minor = 9; in php_http_parser_execute()
913 parser->http_major = 0; in php_http_parser_execute()
914 parser->http_minor = 9; in php_http_parser_execute()
961 parser->http_major = ch - '0'; in php_http_parser_execute()
975 parser->http_major *= 10; in php_http_parser_execute()
976 parser->http_major += ch - '0'; in php_http_parser_execute()
978 if (parser->http_major > 999) goto error; in php_http_parser_execute()
985 parser->http_minor = ch - '0'; in php_http_parser_execute()
1006 parser->http_minor *= 10; in php_http_parser_execute()
1007 parser->http_minor += ch - '0'; in php_http_parser_execute()
1009 if (parser->http_minor > 999) goto error; in php_http_parser_execute()
1223 parser->flags |= F_UPGRADE; in php_http_parser_execute()
1238 parser->content_length = ch - '0'; in php_http_parser_execute()
1287 parser->content_length *= 10; in php_http_parser_execute()
1288 parser->content_length += ch - '0'; in php_http_parser_execute()
1346 parser->flags |= F_CONNECTION_KEEP_ALIVE; in php_http_parser_execute()
1349 parser->flags |= F_CONNECTION_CLOSE; in php_http_parser_execute()
1352 parser->flags |= F_CHUNKED; in php_http_parser_execute()
1365 if (parser->flags & F_TRAILING) { in php_http_parser_execute()
1374 if (parser->flags & F_UPGRADE || parser->method == PHP_HTTP_CONNECT) { in php_http_parser_execute()
1375 parser->upgrade = 1; in php_http_parser_execute()
1385 switch (settings->on_headers_complete(parser)) { in php_http_parser_execute()
1390 parser->flags |= F_SKIPBODY; in php_http_parser_execute()
1399 if (parser->upgrade) { in php_http_parser_execute()
1404 if (parser->flags & F_SKIPBODY) { in php_http_parser_execute()
1407 } else if (parser->flags & F_CHUNKED) { in php_http_parser_execute()
1411 if (parser->content_length == 0) { in php_http_parser_execute()
1415 } else if (parser->content_length > 0) { in php_http_parser_execute()
1419 if (parser->type == PHP_HTTP_REQUEST || php_http_should_keep_alive(parser)) { in php_http_parser_execute()
1434 to_read = MIN(pe - p, (size_t)parser->content_length); in php_http_parser_execute()
1436 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1438 parser->content_length -= to_read; in php_http_parser_execute()
1439 if (parser->content_length == 0) { in php_http_parser_execute()
1450 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1457 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1461 parser->content_length = c; in php_http_parser_execute()
1468 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1485 parser->content_length *= 16; in php_http_parser_execute()
1486 parser->content_length += c; in php_http_parser_execute()
1492 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1503 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1506 if (parser->content_length == 0) { in php_http_parser_execute()
1507 parser->flags |= F_TRAILING; in php_http_parser_execute()
1517 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1519 to_read = MIN(pe - p, (size_t)(parser->content_length)); in php_http_parser_execute()
1522 if (settings->on_body) settings->on_body(parser, p, to_read); in php_http_parser_execute()
1526 if (to_read == parser->content_length) { in php_http_parser_execute()
1530 parser->content_length -= to_read; in php_http_parser_execute()
1535 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1541 assert(parser->flags & F_CHUNKED); in php_http_parser_execute()
1559 parser->state = state; in php_http_parser_execute()
1560 parser->header_state = header_state; in php_http_parser_execute()
1561 parser->index = index; in php_http_parser_execute()
1562 parser->nread = nread; in php_http_parser_execute()
1567 parser->state = s_dead; in php_http_parser_execute()
1573 php_http_should_keep_alive (php_http_parser *parser) in php_http_should_keep_alive() argument
1575 if (parser->http_major > 0 && parser->http_minor > 0) { in php_http_should_keep_alive()
1577 if (parser->flags & F_CONNECTION_CLOSE) { in php_http_should_keep_alive()
1584 if (parser->flags & F_CONNECTION_KEEP_ALIVE) { in php_http_should_keep_alive()
1600 php_http_parser_init (php_http_parser *parser, enum php_http_parser_type t) in php_http_parser_init() argument
1602 parser->type = t; in php_http_parser_init()
1603parser->state = (t == PHP_HTTP_REQUEST ? s_start_req : (t == PHP_HTTP_RESPONSE ? s_start_res : s_s… in php_http_parser_init()
1604 parser->nread = 0; in php_http_parser_init()
1605 parser->upgrade = 0; in php_http_parser_init()
1606 parser->flags = 0; in php_http_parser_init()
1607 parser->method = 0; in php_http_parser_init()