MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / match_host_pattern

Function match_host_pattern

libavformat/network.c:525–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525static int match_host_pattern(const char *pattern, const char *hostname)
526{
527 int len_p, len_h;
528 if (!strcmp(pattern, "*"))
529 return 1;
530 // Skip a possible *. at the start of the pattern
531 if (pattern[0] == '*')
532 pattern++;
533 if (pattern[0] == '.')
534 pattern++;
535 len_p = strlen(pattern);
536 len_h = strlen(hostname);
537 if (len_p > len_h)
538 return 0;
539 // Simply check if the end of hostname is equal to 'pattern'
540 if (!strcmp(pattern, &hostname[len_h - len_p])) {
541 if (len_h == len_p)
542 return 1; // Exact match
543 if (hostname[len_h - len_p - 1] == '.')
544 return 1; // The matched substring is a domain and not just a substring of a domain
545 }
546 return 0;
547}
548
549int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
550{

Callers 1

ff_http_match_no_proxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected