|
Squid Web Cache master
|
#include "anyp/forward.h"#include "anyp/UriScheme.h"#include "ip/Address.h"#include "rfc2181.h"#include "sbuf/SBuf.h"#include <iosfwd>Go to the source code of this file.
Classes | |
| class | AnyP::Uri |
Namespaces | |
| namespace | AnyP |
Enumerations | |
| enum | MatchDomainNameFlags { mdnNone = 0 , mdnHonorWildcards = 1 << 0 , mdnRejectSubsubDomains = 1 << 1 } |
Functions | |
| std::ostream & | AnyP::operator<< (std::ostream &os, const Uri &url) |
| void | urlInitialize (void) |
| char * | urlCanonicalCleanWithoutRequest (const SBuf &url, const HttpRequestMethod &, const AnyP::UriScheme &) |
| const char * | urlCanonicalFakeHttps (const HttpRequest *request) |
| bool | urlIsRelative (const char *) |
| char * | urlRInternal (const char *host, unsigned short port, const char *dir, const char *name) |
| char * | urlInternal (const char *dir, const char *name) |
| bool | urlAppendDomain (char *host) |
| apply append_domain config to the given hostname | |
| int | matchDomainName (const char *host, const char *domain, MatchDomainNameFlags flags=mdnNone) |
| bool | urlCheckRequest (const HttpRequest *) |
| void | urlExtMethodConfigure (void) |
| enum MatchDomainNameFlags |
| int matchDomainName | ( | const char * | host, |
| const char * | domain, | ||
| MatchDomainNameFlags | flags = mdnNone |
||
| ) |
matchDomainName() matches a hostname (usually extracted from traffic) with a domainname when mdnNone or mdnRejectSubsubDomains flags are used according to the following rules:
| HOST | DOMAIN | mdnNone | mdnRejectSubsubDomains |
|---|---|---|---|
| foo.com | foo.com | YES | YES |
| .foo.com | foo.com | YES | YES |
| x.foo.com | foo.com | NO | NO |
| foo.com | .foo.com | YES | YES |
| .foo.com | .foo.com | YES | YES |
| x.foo.com | .foo.com | YES | YES |
| .x.foo.com | .foo.com | YES | NO |
| y.x.foo.com | .foo.com | YES | NO |
if mdnHonorWildcards flag is set then the matchDomainName() also accepts optional wildcards on hostname:
| HOST | DOMAIN | MATCH? |
|---|---|---|
| *.foo.com | x.foo.com | YES |
| *.foo.com | .x.foo.com | YES |
| *.foo.com | .foo.com | YES |
| *.foo.com | foo.com | NO |
The combination of mdnHonorWildcards and mdnRejectSubsubDomains flags is supported.
| 0 | means the host matches the domain |
| 1 | means the host is greater than the domain |
| -1 | means the host is less than the domain |
Definition at line 903 of file Uri.cc.
References mdnHonorWildcards, mdnRejectSubsubDomains, and xtolower.
Referenced by aclHostDomainCompare(), aclHostDomainCompare(), Acl::SplayInserter< DataValue >::Compare(), ClientRequestContext::hostHeaderVerify(), neighborType(), and urlInitialize().
| bool urlAppendDomain | ( | char * | host | ) |
Appends configured append_domain to hostname, assuming the given buffer is at least SQUIDHOSTNAMELEN bytes long, and that the host FQDN is not a 'dotless' TLD.
Definition at line 297 of file Uri.cc.
References SquidConfig::appendDomain, SquidConfig::appendDomainLen, Config, debugs, and SQUIDHOSTNAMELEN.
Referenced by internalRemoteUri(), and AnyP::Uri::parse().
| char * urlCanonicalCleanWithoutRequest | ( | const SBuf & | url, |
| const HttpRequestMethod & | method, | ||
| const AnyP::UriScheme & | scheme | ||
| ) |
call HttpRequest::canonicalCleanUrl() instead if you have HttpRequest
Definition at line 790 of file Uri.cc.
References Config, LOCAL_ARRAY, MAX_URL, Http::METHOD_CONNECT, SquidConfig::onoff, AnyP::PROTO_URN, rfc1738_escape_unescaped, SQUIDSBUFPH, SQUIDSBUFPRINT, stringHasCntl(), SquidConfig::strip_query_terms, and xstrncpy().
Referenced by HttpRequest::canonicalCleanUrl(), ClientHttpRequest::setErrorUri(), and ClientHttpRequest::setLogUriToRawUri().
| const char * urlCanonicalFakeHttps | ( | const HttpRequest * | request | ) |
Yet another alternative to urlCanonical. This one adds the https:// parts to Http::METHOD_CONNECT URL for use in error page outputs. Luckily we can leverage the others instead of duplicating.
Definition at line 819 of file Uri.cc.
References HttpRequest::canonicalCleanUrl(), AnyP::Uri::host(), LOCAL_ARRAY, MAX_URL, HttpRequest::method, Http::METHOD_CONNECT, AnyP::Uri::port(), and HttpRequest::url.
Referenced by ErrorState::compileLegacyCode().
| bool urlCheckRequest | ( | const HttpRequest * | r | ) |
Definition at line 1002 of file Uri.cc.
References AnyP::Uri::Asterisk(), HttpHeader::getInt64(), AnyP::Uri::getScheme(), Http::Message::header, Http::MAX_FORWARDS, HttpRequest::method, Http::METHOD_CONNECT, Http::METHOD_GET, Http::METHOD_HEAD, Http::METHOD_OPTIONS, Http::METHOD_PURGE, Http::METHOD_PUT, Http::METHOD_TRACE, AnyP::Uri::path(), AnyP::PROTO_FTP, AnyP::PROTO_HTTP, AnyP::PROTO_HTTPS, AnyP::PROTO_URN, AnyP::PROTO_WAIS, AnyP::PROTO_WHOIS, and HttpRequest::url.
Referenced by clientProcessRequest().
| void urlExtMethodConfigure | ( | void | ) |
| void urlInitialize | ( | void | ) |
Definition at line 212 of file Uri.cc.
References assert, debugs, matchDomainName(), mdnHonorWildcards, mdnRejectSubsubDomains, AnyP::PROTO_MAX, and AnyP::ProtocolType_str.
Referenced by mainInitialize().
| char * urlInternal | ( | const char * | dir, |
| const char * | name | ||
| ) |
| bool urlIsRelative | ( | const char * | url | ) |
Test if a URL is a relative reference.
Governed by RFC 3986 section 4.2
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
Definition at line 846 of file Uri.cc.
Referenced by purgeEntriesByHeader().
| char * urlRInternal | ( | const char * | host, |
| unsigned short | port, | ||
| const char * | dir, | ||
| const char * | name | ||
| ) |