#include <URL.h>

Collaboration diagram for URL:

Public Member Functions

 URL ()
 
 URL (AnyP::UriScheme const &aScheme)
 
 URL (const URL &other)
 
URLoperator= (const URL &o)
 
void clear ()
 
void touch ()
 clear the cached URI display forms More...
 
bool parse (const HttpRequestMethod &, const char *url)
 
AnyP::UriScheme const & getScheme () const
 
void setScheme (const AnyP::ProtocolType &p, const char *str)
 convert the URL scheme to that given More...
 
void userInfo (const SBuf &s)
 
const SBufuserInfo () const
 
void host (const char *src)
 
const char * host (void) const
 
int hostIsNumeric (void) const
 
Ip::Address const & hostIP (void) const
 
void port (unsigned short p)
 
unsigned short port () const
 
void path (const char *p)
 
void path (const SBuf &p)
 
const SBufpath () const
 
SBufauthority (bool requirePort=false) const
 
SBufabsolute () const
 

Static Public Member Functions

static const SBufSlashPath ()
 the static '/' default URL-path More...
 
static const SBufAsterisk ()
 the static '*' pseudo-URL More...
 

Private Member Functions

 MEMPROXY_CLASS (URL)
 
void parseFinish (const AnyP::ProtocolType, const char *const, const char *const, const char *const, const SBuf &, const int)
 Update the URL object with parsed URI data. More...
 

Private Attributes

AnyP::UriScheme scheme_
 
SBuf userInfo_
 
char host_ [SQUIDHOSTNAMELEN]
 string representation of the URI authority name or IP More...
 
bool hostIsNumeric_
 whether the authority 'host' is a raw-IP More...
 
Ip::Address hostAddr_
 binary representation of the URI authority if it is a raw-IP More...
 
unsigned short port_
 URL port. More...
 
SBuf path_
 URL path segment. More...
 
SBuf authorityHttp_
 RFC 7230 section 5.3.3 authority, maybe without default-port. More...
 
SBuf authorityWithPort_
 RFC 7230 section 5.3.3 authority with explicit port. More...
 
SBuf absolute_
 RFC 7230 section 5.3.2 absolute-URI. More...
 

Detailed Description

The URL class represents a Uniform Resource Location

Governed by RFC 3986

Definition at line 24 of file URL.h.

Constructor & Destructor Documentation

URL::URL ( )
inline

Definition at line 29 of file URL.h.

References host_.

URL::URL ( AnyP::UriScheme const &  aScheme)

Definition at line 15 of file stub_url.cc.

References STUB.

URL::URL ( const URL other)
inline

Definition at line 31 of file URL.h.

References operator=().

Member Function Documentation

SBuf & URL::absolute ( ) const

The absolute-form URI for currently stored values.

As defined by RFC 7230 section 5.3.3 this form omits the userinfo@ field from RFC 3986 defined authority segments when the protocol scheme is http: or https:.

Definition at line 488 of file url.cc.

References absolute_, SBuf::append(), authority(), getScheme(), SBuf::isEmpty(), MAX_URL, path(), AnyP::PROTO_HTTP, AnyP::PROTO_HTTPS, AnyP::PROTO_URN, SBuf::reserveCapacity(), and userInfo().

Referenced by HttpRequest::effectiveRequestUri(), ACLFilledChecklist::syncAle(), and urlMakeAbsolute().

const SBuf & URL::Asterisk ( )
static

Definition at line 26 of file stub_url.cc.

Referenced by parse(), and urlCheckRequest().

SBuf & URL::authority ( bool  requirePort = false) const

The authority-form URI for currently stored values.

As defined by RFC 7230 section 5.3.3 this form omits the userinfo@ field from RFC 3986 defined authority segment.

Parameters
requirePortwhen true the port will be included, otherwise port will be elided when it is the default for the current scheme.

Definition at line 470 of file url.cc.

References SBuf::append(), SBuf::appendf(), authorityHttp_, authorityWithPort_, getScheme(), host(), SBuf::isEmpty(), and port().

Referenced by absolute(), Http::One::Server::buildHttpRequest(), clientProcessRequest(), copyOneHeaderFromClientsideRequestToUpstreamRequest(), HttpRequest::effectiveRequestUri(), HttpStateData::httpBuildRequestHeader(), internalRemoteUri(), operator<<(), peerAllowedToUse(), Ssl::ServerBump::ServerBump(), and urlMakeAbsolute().

void URL::clear ( )
inline
const char* URL::host ( void  ) const
inline

Definition at line 70 of file URL.h.

References host_.

Referenced by authority(), and parseFinish().

Ip::Address const& URL::hostIP ( void  ) const
inline

Definition at line 72 of file URL.h.

References hostAddr_.

Referenced by ACLDestinationIP::match().

int URL::hostIsNumeric ( void  ) const
inline

Definition at line 71 of file URL.h.

References hostIsNumeric_.

Referenced by ACLDestinationDomainStrategy::match(), and ACLDestinationIP::match().

URL::MEMPROXY_CLASS ( URL  )
private
URL& URL::operator= ( const URL o)
inline

Definition at line 34 of file URL.h.

References host_, hostAddr_, hostIsNumeric_, path_, port_, scheme_, touch(), and userInfo_.

Referenced by URL().

void URL::parseFinish ( const AnyP::ProtocolType  protocol,
const char * const  protoStr,
const char * const  aUrlPath,
const char * const  aHost,
const SBuf aLogin,
const int  aPort 
)
private

Definition at line 447 of file url.cc.

References host(), path(), port(), setScheme(), and userInfo().

Referenced by parse().

void URL::path ( const SBuf p)
inline

Definition at line 78 of file URL.h.

References p, path_, and touch().

const SBuf & URL::path ( ) const

Definition at line 63 of file url.cc.

References SBuf::isEmpty(), path_, AnyP::PROTO_HTTP, AnyP::PROTO_HTTPS, scheme_, and SlashPath().

Referenced by absolute(), parse(), and parseFinish().

unsigned short URL::port ( ) const
inline

Definition at line 75 of file URL.h.

References port_.

Referenced by authority(), and parseFinish().

void URL::setScheme ( const AnyP::ProtocolType p,
const char *  str 
)
inline
const SBuf & URL::SlashPath ( )
static

Definition at line 40 of file url.cc.

Referenced by path().

void URL::touch ( )

Definition at line 20 of file stub_url.cc.

Referenced by clear(), host(), operator=(), path(), port(), setScheme(), and userInfo().

void URL::userInfo ( const SBuf s)
inline
const SBuf& URL::userInfo ( ) const
inline

Definition at line 67 of file URL.h.

References userInfo_.

Referenced by absolute(), and parseFinish().

Member Data Documentation

SBuf URL::absolute_
mutableprivate

Definition at line 149 of file URL.h.

Referenced by absolute().

SBuf URL::authorityHttp_
mutableprivate

Definition at line 147 of file URL.h.

Referenced by authority().

SBuf URL::authorityWithPort_
mutableprivate

Definition at line 148 of file URL.h.

Referenced by authority().

char URL::host_[SQUIDHOSTNAMELEN]
private

Definition at line 137 of file URL.h.

Referenced by clear(), host(), operator=(), and URL().

Ip::Address URL::hostAddr_
private

Definition at line 139 of file URL.h.

Referenced by clear(), host(), hostIP(), and operator=().

bool URL::hostIsNumeric_
private

Definition at line 138 of file URL.h.

Referenced by clear(), host(), hostIsNumeric(), and operator=().

SBuf URL::path_
private

Definition at line 144 of file URL.h.

Referenced by operator=(), and path().

unsigned short URL::port_
private

Definition at line 141 of file URL.h.

Referenced by clear(), operator=(), and port().

AnyP::UriScheme URL::scheme_
private
The scheme of this URL. This has the 'type code' smell about it. In future we may want to make the methods that dispatch based on the scheme virtual and have a class per protocol.
On the other hand, having Protocol as an explicit concept is useful, see for instance the ACLProtocol acl type. One way to represent this is to have one prototype URL with no host etc for each scheme, another is to have an explicit scheme class, and then each URL class could be a subclass of the scheme. Another way is one instance of a AnyP::UriScheme class instance for each URL scheme we support, and one URL class for each manner of treating the scheme : a Hierarchical URL, a non-hierarchical URL etc.
Deferring the decision, its a type code for now. RBC 20060507.
In order to make taking any of these routes easy, scheme is private and immutable, only settable at construction time,

Definition at line 131 of file URL.h.

Referenced by clear(), getScheme(), operator=(), path(), and setScheme().

SBuf URL::userInfo_
private

Definition at line 133 of file URL.h.

Referenced by operator=(), and userInfo().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors