]>
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"
18 * The URL class represents a Uniform Resource Location
25 URL(AnyP::UriScheme
const &aScheme
) : scheme_(aScheme
) {}
28 scheme_
=AnyP::PROTO_NONE
;
31 AnyP::UriScheme
const & getScheme() const {return scheme_
;}
33 /// convert the URL scheme to that given
34 void setScheme(const AnyP::ProtocolType
&p
) {scheme_
=p
;}
39 * The scheme of this URL. This has the 'type code' smell about it.
40 * In future we may want to make the methods that dispatch based on
41 * the scheme virtual and have a class per protocol.
43 * On the other hand, having Protocol as an explicit concept is useful,
44 * see for instance the ACLProtocol acl type. One way to represent this
45 * is to have one prototype URL with no host etc for each scheme,
46 * another is to have an explicit scheme class, and then each URL class
47 * could be a subclass of the scheme. Another way is one instance of
48 * a AnyP::UriScheme class instance for each URL scheme we support, and one URL
49 * class for each manner of treating the scheme : a Hierarchical URL, a
50 * non-hierarchical URL etc.
52 * Deferring the decision, its a type code for now. RBC 20060507.
54 * In order to make taking any of these routes easy, scheme is private
55 * and immutable, only settable at construction time,
57 AnyP::UriScheme scheme_
;
60 MEMPROXY_CLASS_INLINE(URL
);
63 class HttpRequestMethod
;
65 AnyP::ProtocolType
urlParseProtocol(const char *, const char *e
= NULL
);
66 void urlInitialize(void);
67 HttpRequest
*urlParse(const HttpRequestMethod
&, char *, HttpRequest
*request
= NULL
);
68 const char *urlCanonical(HttpRequest
*);
69 char *urlCanonicalClean(const HttpRequest
*);
70 const char *urlCanonicalFakeHttps(const HttpRequest
* request
);
71 bool urlIsRelative(const char *);
72 char *urlMakeAbsolute(const HttpRequest
*, const char *);
73 char *urlRInternal(const char *host
, unsigned short port
, const char *dir
, const char *name
);
74 char *urlInternal(const char *dir
, const char *name
);
75 int matchDomainName(const char *host
, const char *domain
);
76 int urlCheckRequest(const HttpRequest
*);
77 int urlDefaultPort(AnyP::ProtocolType p
);
78 char *urlHostname(const char *url
);
79 void urlExtMethodConfigure(void);
81 #endif /* SQUID_SRC_URL_H_H */