url.cc File Reference
#include "squid.h"
#include "globals.h"
#include "HttpRequest.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "SquidString.h"
#include "URL.h"
Include dependency graph for url.cc:

Go to the source code of this file.

Classes

class  URLHostName
 

Functions

void urlInitialize (void)
 
AnyP::ProtocolType urlParseProtocol (const char *b)
 
char * urlCanonicalClean (const HttpRequest *request)
 
const char * urlCanonicalFakeHttps (const HttpRequest *request)
 
bool urlIsRelative (const char *url)
 
char * urlMakeAbsolute (const HttpRequest *req, const char *relUrl)
 
int matchDomainName (const char *h, const char *d, uint flags)
 
int urlCheckRequest (const HttpRequest *r)
 
char * urlHostname (const char *url)
 

Variables

static const char valid_hostname_chars_u []
 
static const char valid_hostname_chars []
 

Function Documentation

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

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 url.cc.

References mdnHonorWildcards, mdnRejectSubsubDomains, and xtolower.

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

char* urlCanonicalClean ( const HttpRequest request)
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 url.cc.

References buf, URL::host(), LOCAL_ARRAY, MAX_URL, HttpRequest::method, Http::METHOD_CONNECT, URL::port(), HttpRequest::url, and urlCanonicalClean().

Referenced by ErrorState::Convert().

char* urlHostname ( const char *  url)

Definition at line 858 of file url.cc.

References URLHostName::extract().

Referenced by htcpTstReply(), and urnParseReply().

void urlInitialize ( void  )
bool urlIsRelative ( const char *  url)

Definition at line 568 of file url.cc.

References NULL, and p.

Referenced by purgeEntriesByHeader().

AnyP::ProtocolType urlParseProtocol ( const char *  b)

Parse the scheme name from string b, into protocol type. The string must be 0-terminated.

Definition at line 123 of file url.cc.

References len, AnyP::PROTO_CACHE_OBJECT, AnyP::PROTO_COAP, AnyP::PROTO_COAPS, AnyP::PROTO_FTP, AnyP::PROTO_GOPHER, AnyP::PROTO_HTTP, AnyP::PROTO_HTTPS, AnyP::PROTO_NONE, AnyP::PROTO_UNKNOWN, AnyP::PROTO_URN, AnyP::PROTO_WAIS, and AnyP::PROTO_WHOIS.

Referenced by URL::parse().

Variable Documentation

const char valid_hostname_chars[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-."
"[:]"

Definition at line 25 of file url.cc.

Referenced by URL::parse().

const char valid_hostname_chars_u[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-._"
"[:]"

Definition at line 19 of file url.cc.

Referenced by URL::parse().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors