MCPcopy Create free account
hub / github.com/apache/cloudberry / http_parser_execute

Function http_parser_execute

gpcontrib/gpcloud/lib/http_parser.cpp:630–2123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630size_t http_parser_execute (http_parser *parser,
631 const http_parser_settings *settings,
632 const char *data,
633 size_t len)
634{
635 char c, ch;
636 int8_t unhex_val;
637 const char *p = data;
638 const char *header_field_mark = 0;
639 const char *header_value_mark = 0;
640 const char *url_mark = 0;
641 const char *body_mark = 0;
642 const char *status_mark = 0;
643 enum state p_state = (enum state) parser->state;
644
645 /* We're in an error state. Don't bother doing anything. */
646 if (HTTP_PARSER_ERRNO(parser) != HPE_OK) {
647 return 0;
648 }
649
650 if (len == 0) {
651 switch (CURRENT_STATE()) {
652 case s_body_identity_eof:
653 /* Use of CALLBACK_NOTIFY() here would erroneously return 1 byte read if
654 * we got paused.
655 */
656 CALLBACK_NOTIFY_NOADVANCE(message_complete);
657 return 0;
658
659 case s_dead:
660 case s_start_req_or_res:
661 case s_start_res:
662 case s_start_req:
663 return 0;
664
665 default:
666 SET_ERRNO(HPE_INVALID_EOF_STATE);
667 return 1;
668 }
669 }
670
671
672 if (CURRENT_STATE() == s_header_field)
673 header_field_mark = data;
674 if (CURRENT_STATE() == s_header_value)
675 header_value_mark = data;
676 switch (CURRENT_STATE()) {
677 case s_req_path:
678 case s_req_schema:
679 case s_req_schema_slash:
680 case s_req_schema_slash_slash:
681 case s_req_server_start:
682 case s_req_server:
683 case s_req_server_with_at:
684 case s_req_query_string_start:
685 case s_req_query_string:
686 case s_req_fragment_start:
687 case s_req_fragment:

Callers

nothing calls this directly

Calls 3

parse_url_charFunction · 0.85
MINFunction · 0.85
http_message_needs_eofFunction · 0.85

Tested by

no test coverage detected