]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/URL.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_URL_H
10 #define SQUID_SRC_URL_H
12 #include "anyp/UriScheme.h"
16 * The URL class represents a Uniform Resource Location
24 URL(AnyP::UriScheme
const &aScheme
) : scheme_(aScheme
) {}
27 scheme_
=AnyP::PROTO_NONE
;
30 AnyP::UriScheme
const & getScheme() const {return scheme_
;}
32 /// convert the URL scheme to that given
33 void setScheme(const AnyP::ProtocolType
&p
) {scheme_
=p
;}
35 void userInfo(const SBuf
&s
) {userInfo_
=s
;}
36 const SBuf
&userInfo() const {return userInfo_
;}
38 /// the static '*' pseudo-URL
39 static const SBuf
&Asterisk();
44 * The scheme of this URL. This has the 'type code' smell about it.
45 * In future we may want to make the methods that dispatch based on
46 * the scheme virtual and have a class per protocol.
48 * On the other hand, having Protocol as an explicit concept is useful,
49 * see for instance the ACLProtocol acl type. One way to represent this
50 * is to have one prototype URL with no host etc for each scheme,
51 * another is to have an explicit scheme class, and then each URL class
52 * could be a subclass of the scheme. Another way is one instance of
53 * a AnyP::UriScheme class instance for each URL scheme we support, and one URL
54 * class for each manner of treating the scheme : a Hierarchical URL, a
55 * non-hierarchical URL etc.
57 * Deferring the decision, its a type code for now. RBC 20060507.
59 * In order to make taking any of these routes easy, scheme is private
60 * and immutable, only settable at construction time,
62 AnyP::UriScheme scheme_
;
64 SBuf userInfo_
; // aka 'URL-login'
68 class HttpRequestMethod
;
70 AnyP::ProtocolType
urlParseProtocol(const char *, const char *e
= NULL
);
71 void urlInitialize(void);
72 HttpRequest
*urlParse(const HttpRequestMethod
&, char *, HttpRequest
*request
= NULL
);
73 const char *urlCanonical(HttpRequest
*);
74 char *urlCanonicalClean(const HttpRequest
*);
75 const char *urlCanonicalFakeHttps(const HttpRequest
* request
);
76 bool urlIsRelative(const char *);
77 char *urlMakeAbsolute(const HttpRequest
*, const char *);
78 char *urlRInternal(const char *host
, unsigned short port
, const char *dir
, const char *name
);
79 char *urlInternal(const char *dir
, const char *name
);
80 int matchDomainName(const char *host
, const char *domain
);
81 int urlCheckRequest(const HttpRequest
*);
82 int urlDefaultPort(AnyP::ProtocolType p
);
83 char *urlHostname(const char *url
);
84 void urlExtMethodConfigure(void);
86 #endif /* SQUID_SRC_URL_H_H */