MCPcopy Create free account
hub / github.com/apache/httpd / is_absolute_uri

Function is_absolute_uri

modules/mappers/mod_rewrite.c:579–699  ·  view source on GitHub ↗

return number of chars of the scheme (incl. '://') * if the URI is absolute (includes a scheme etc.) * otherwise 0. * If supportqs is not NULL, we return a whether or not * the scheme supports a query string or not. * * NOTE: If you add new schemes here, please have a * look at escape_absolute_uri and splitout_queryargs. * Not every scheme takes query strings and some schemes

Source from the content-addressed store, hash-verified

577 * to extend mod_rewrite at runtime.
578 */
579static unsigned is_absolute_uri(char *uri, int *supportsqs)
580{
581 int dummy, *sqs;
582
583 sqs = (supportsqs ? supportsqs : &dummy);
584 *sqs = 0;
585 /* fast exit */
586 if (*uri == '/' || strlen(uri) <= 5) {
587 return 0;
588 }
589
590 switch (*uri++) {
591 case 'a':
592 case 'A':
593 if (!ap_cstr_casecmpn(uri, "jp://", 5)) { /* ajp:// */
594 *sqs = 1;
595 return 6;
596 }
597 break;
598
599 case 'b':
600 case 'B':
601 if (!ap_cstr_casecmpn(uri, "alancer://", 10)) { /* balancer:// */
602 *sqs = 1;
603 return 11;
604 }
605 break;
606
607 case 'f':
608 case 'F':
609 if (!ap_cstr_casecmpn(uri, "tp://", 5)) { /* ftp:// */
610 return 6;
611 }
612 if (!ap_cstr_casecmpn(uri, "cgi://", 6)) { /* fcgi:// */
613 *sqs = 1;
614 return 7;
615 }
616 break;
617
618 case 'g':
619 case 'G':
620 if (!ap_cstr_casecmpn(uri, "opher://", 8)) { /* gopher:// */
621 return 9;
622 }
623 break;
624
625 case 'h':
626 case 'H':
627 if (!ap_cstr_casecmpn(uri, "ttp://", 6)) { /* http:// */
628 *sqs = 1;
629 return 7;
630 }
631 else if (!ap_cstr_casecmpn(uri, "ttps://", 7)) { /* https:// */
632 *sqs = 1;
633 return 8;
634 }
635 else if (!ap_cstr_casecmpn(uri, "2://", 4)) { /* h2:// */
636 *sqs = 1;

Callers 5

splitout_queryargsFunction · 0.85
fully_qualify_uriFunction · 0.85
apply_rewrite_ruleFunction · 0.85
hook_uri2fileFunction · 0.85
hook_fixupFunction · 0.85

Calls 1

ap_cstr_casecmpnFunction · 0.85

Tested by

no test coverage detected