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

Function parse_url_char

gpcontrib/gpcloud/lib/http_parser.cpp:482–628  ·  view source on GitHub ↗

Our URL parser. * * This is designed to be shared by http_parser_execute() for URL validation, * hence it has a state transition + byte-for-byte interface. In addition, it * is meant to be embedded in http_parser_parse_url(), which does the dirty * work of turning state transitions URL components for its API. * * This function should only be invoked with non-space characters. It is * assum

Source from the content-addressed store, hash-verified

480 * URL and non-URL states by looking for these.
481 */
482static enum state
483parse_url_char(enum state s, const char ch)
484{
485 if (ch == ' ' || ch == '\r' || ch == '\n') {
486 return s_dead;
487 }
488
489#if HTTP_PARSER_STRICT
490 if (ch == '\t' || ch == '\f') {
491 return s_dead;
492 }
493#endif
494
495 switch (s) {
496 case s_req_spaces_before_url:
497 /* Proxied requests are followed by scheme of an absolute URI (alpha).
498 * All methods except CONNECT are followed by '/' or '*'.
499 */
500
501 if (ch == '/' || ch == '*') {
502 return s_req_path;
503 }
504
505 if (IS_ALPHA(ch)) {
506 return s_req_schema;
507 }
508
509 break;
510
511 case s_req_schema:
512 if (IS_ALPHA(ch)) {
513 return s;
514 }
515
516 if (ch == ':') {
517 return s_req_schema_slash;
518 }
519
520 break;
521
522 case s_req_schema_slash:
523 if (ch == '/') {
524 return s_req_schema_slash_slash;
525 }
526
527 break;
528
529 case s_req_schema_slash_slash:
530 if (ch == '/') {
531 return s_req_server_start;
532 }
533
534 break;
535
536 case s_req_server_with_at:
537 if (ch == '@') {
538 return s_dead;
539 }

Callers 2

http_parser_executeFunction · 0.85
http_parser_parse_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected