Uri.h File Reference
#include "anyp/UriScheme.h"
#include "ip/Address.h"
#include "rfc2181.h"
#include "sbuf/SBuf.h"
#include <iosfwd>
Include dependency graph for Uri.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  AnyP::Uri




enum  MatchDomainNameFlags {
  mdnNone = 0,
  mdnHonorWildcards = 1 << 0,
  mdnRejectSubsubDomains = 1 << 1


std::ostream & operator<< (std::ostream &os, const AnyP::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 * urlMakeAbsolute (const HttpRequest *, const char *)
char * urlRInternal (const char *host, unsigned short port, const char *dir, const char *name)
char * urlInternal (const char *dir, const char *name)
int matchDomainName (const char *host, const char *domain, uint8_t flags=mdnNone)
int urlCheckRequest (const HttpRequest *)
char * urlHostname (const char *url)
void urlExtMethodConfigure (void)

Enumeration Type Documentation

◆ MatchDomainNameFlags


Definition at line 197 of file Uri.h.

Function Documentation

◆ matchDomainName()

int matchDomainName ( const char *  host,
const char *  domain,
uint8_t  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:

*.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.

Return values
0means the host matches the domain
1means the host is greater than the domain
-1means the host is less than the domain

Definition at line 660 of file Uri.cc.

References mdnHonorWildcards, mdnRejectSubsubDomains, and xtolower.

Referenced by aclHostDomainCompare(), check_domain(), ClientRequestContext::hostHeaderVerify(), neighborType(), and urlInitialize().

◆ operator<<()

◆ urlCanonicalCleanWithoutRequest()

char* urlCanonicalCleanWithoutRequest ( const SBuf url,
const HttpRequestMethod method,
const AnyP::UriScheme scheme 

call HttpRequest::canonicalCleanUrl() instead if you have HttpRequest

a pointer to a local static buffer containing request URI that honors strip_query_terms and %-encodes unsafe URI characters
AYJ: Performance: This is an almost duplicate of HttpRequest::effectiveRequestUri(). But elides the query-string. After copying it on in the first place! Would be less code to merge the two with a flag parameter. and never copy the query-string part in the first place

Definition at line 518 of file Uri.cc.

References buf, 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(), operator<<(), ClientHttpRequest::setErrorUri(), and ClientHttpRequest::setLogUriToRawUri().

◆ urlCanonicalFakeHttps()

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 547 of file Uri.cc.

References buf, HttpRequest::canonicalCleanUrl(), AnyP::Uri::host(), LOCAL_ARRAY, MAX_URL, HttpRequest::method, Http::METHOD_CONNECT, AnyP::Uri::port(), and HttpRequest::url.

Referenced by ErrorState::compileLegacyCode(), and operator<<().

◆ urlCheckRequest()

◆ urlExtMethodConfigure()

void urlExtMethodConfigure ( void  )

◆ urlHostname()

char* urlHostname ( const char *  url)

Definition at line 858 of file Uri.cc.

References URLHostName::extract(), URLHostName::Host, and SQUIDHOSTNAMELEN.

Referenced by htcpTstReply(), and urnParseReply().

◆ urlInitialize()

void urlInitialize ( void  )

◆ urlInternal()

char* urlInternal ( const char *  dir,
const char *  name 

Referenced by operator<<().

◆ urlIsRelative()

bool urlIsRelative ( const char *  )

Definition at line 568 of file Uri.cc.

References NULL, and p.

Referenced by operator<<(), and purgeEntriesByHeader().

◆ urlMakeAbsolute()

◆ urlRInternal()

char* urlRInternal ( const char *  host,
unsigned short  port,
const char *  dir,
const char *  name 

Referenced by operator<<().






Web Site Translations