MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / parse_url_char

Function parse_url_char

libs/qhttpserver/http-parser/http_parser.c:478–624  ·  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

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

Callers 2

http_parser_executeFunction · 0.85
http_parser_parse_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected