]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4791: Build failure on MacOS (#220)
authorAmos Jeffries <yadij@users.noreply.github.com>
Tue, 12 Jun 2018 15:38:17 +0000 (15:38 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Thu, 21 Jun 2018 11:24:24 +0000 (23:24 +1200)
The src/URL.h and src/acl/Url.h files clash on MacOS case-
insensitive filesystem.

Resolve this and incorrect naming issue by moving class URL into
the AnyP namespace as AnyP::Uri.

42 files changed:
src/HttpRequest.cc
src/HttpRequest.h
src/Makefile.am
src/acl/Asn.cc
src/acl/DomainData.cc
src/acl/ServerName.cc
src/acl/Url.cc
src/adaptation/ServiceConfig.cc
src/adaptation/ecap/MessageRep.cc
src/adaptation/icap/ModXact.cc
src/anyp/Makefile.am
src/anyp/Uri.cc [moved from src/url.cc with 98% similarity]
src/anyp/Uri.h [moved from src/URL.h with 90% similarity]
src/anyp/forward.h
src/carp.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/clients/Client.cc
src/clients/FtpGateway.cc
src/errorpage.cc
src/external_acl.cc
src/format/Format.cc
src/htcp.cc
src/http.cc
src/icmp/net_db.cc
src/icmp/net_db.h
src/internal.cc
src/main.cc
src/neighbors.cc
src/neighbors.h
src/peer_select.cc
src/refresh.cc
src/servers/FtpServer.cc
src/ssl/ServerBump.cc
src/ssl/support.cc
src/store_key_md5.cc
src/tests/Stub.list
src/tests/stub_libanyp.cc [new file with mode: 0644]
src/tests/stub_libicmp.cc
src/tests/testURL.cc
src/urn.cc

index 7f8b1d109104ca0ea7ebe36bd8a9282c4e23869d..41b77fe02816bebc5225bb32c6483d28463ad9ff 100644 (file)
@@ -30,7 +30,6 @@
 #include "sbuf/StringConvert.h"
 #include "SquidConfig.h"
 #include "Store.h"
-#include "URL.h"
 
 #if USE_AUTH
 #include "auth/UserRequest.h"
index edc7038f025f886c6cb0b6e47278f4cebfa070b4..38c0b8a4bf98bb0743452fe4a9e81e694012978a 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef SQUID_HTTPREQUEST_H
 #define SQUID_HTTPREQUEST_H
 
+#include "anyp/Uri.h"
 #include "base/CbcPointer.h"
 #include "dns/forward.h"
 #include "err_type.h"
@@ -18,7 +19,6 @@
 #include "MasterXaction.h"
 #include "Notes.h"
 #include "RequestFlags.h"
-#include "URL.h"
 
 #if USE_AUTH
 #include "auth/UserRequest.h"
@@ -100,7 +100,7 @@ protected:
 
 public:
     HttpRequestMethod method;
-    URL url; ///< the request URI
+    AnyP::Uri url; ///< the request URI
 
 private:
 #if USE_ADAPTATION
index 5467f5a71378431fb41fe353c072e53277e66525..0efba2455872f157452d05789f54ffdec87d7d2c 100644 (file)
@@ -473,8 +473,6 @@ squid_SOURCES = \
        tunnel.cc \
        typedefs.h \
        $(UNLINKDSOURCE) \
-       url.cc \
-       URL.h \
        urn.h \
        urn.cc \
        wccp.h \
@@ -997,7 +995,7 @@ tests_testHttpReply_SOURCES=\
        tests/testHttpReply.cc \
        tests/testHttpReply.h \
        tests/stub_time.cc \
-       url.cc \
+       tests/stub_libanyp.cc \
        wordlist.h \
        wordlist.cc
 nodist_tests_testHttpReply_SOURCES=\
@@ -1120,8 +1118,7 @@ tests_testACLMaxUserIP_SOURCES= \
        tests/testACLMaxUserIP.cc \
        tests/testACLMaxUserIP.h \
        tests/stub_time.cc \
-       url.cc \
-       URL.h \
+       tests/stub_libanyp.cc \
        MemBuf.cc \
        wordlist.h \
        wordlist.cc
@@ -1373,7 +1370,7 @@ tests_testCacheManager_SOURCES = \
        tests/stub_SwapDir.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
-       url.cc \
+       tests/stub_libanyp.cc \
        urn.h \
        urn.cc \
        wccp2.h \
@@ -1557,7 +1554,7 @@ tests_testDiskIO_SOURCES = \
        tests/testStoreSupport.h \
        tests/stub_time.cc \
        $(UNLINKDSOURCE) \
-       url.cc \
+       tests/stub_libanyp.cc \
        $(WIN32_SOURCE) \
        wordlist.h \
        wordlist.cc \
@@ -1807,7 +1804,7 @@ tests_testEvent_SOURCES = \
        tests/stub_tunnel.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
-       url.cc \
+       tests/stub_libanyp.cc \
        urn.h \
        urn.cc \
        wccp2.h \
@@ -2043,7 +2040,7 @@ tests_testEventLoop_SOURCES = \
        tests/stub_tunnel.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
-       url.cc \
+       tests/stub_libanyp.cc \
        urn.h \
        urn.cc \
        wccp2.h \
@@ -2274,7 +2271,7 @@ tests_test_http_range_SOURCES = \
        tools.cc \
        tests/stub_tunnel.cc \
        $(UNLINKDSOURCE) \
-       url.cc \
+       tests/stub_libanyp.cc \
        urn.h \
        urn.cc \
        wccp2.h \
@@ -2379,6 +2376,7 @@ tests_testHttp1Parser_SOURCES = \
        tests/testHttp1Parser.cc \
        tests/testHttp1Parser.h \
        tests/stub_time.cc \
+       tests/stub_libanyp.cc \
        wordlist.h \
        wordlist.cc
 nodist_tests_testHttp1Parser_SOURCES = \
@@ -2577,7 +2575,6 @@ tests_testHttpRequest_SOURCES = \
        tests/stub_tunnel.cc \
        tests/stub_SwapDir.cc \
        MemStore.cc \
-       url.cc \
        urn.h \
        urn.cc \
        wccp2.h \
@@ -2815,7 +2812,7 @@ tests_testStore_SOURCES= \
        tests/TestSwapDir.cc \
        tests/TestSwapDir.h \
        tests/stub_time.cc \
-       url.cc \
+       tests/stub_libanyp.cc \
        wordlist.h \
        wordlist.cc
 
@@ -3014,7 +3011,7 @@ tests_testUfs_SOURCES = \
        HttpHdrCc.cci \
        HttpHdrSc.cc \
        HttpHdrScTarget.cc \
-       url.cc \
+       tests/stub_libanyp.cc \
        StatCounters.h \
        StatCounters.cc \
        StatHist.h \
@@ -3214,7 +3211,7 @@ tests_testRock_SOURCES = \
        tools.h \
        tests/stub_tools.cc \
        time.cc \
-       url.cc \
+       tests/stub_libanyp.cc \
        wordlist.h \
        wordlist.cc \
        $(DELAY_POOL_SOURCE) \
@@ -3441,7 +3438,6 @@ tests_testURL_SOURCES = \
        tools.h \
        tools.cc \
        tests/stub_tunnel.cc \
-       url.cc \
        urn.h \
        urn.cc \
        wccp2.h \
index 717bbcca891408f9afe5e2834e936b3b820cbb48..ff15a8dad5f0e1ad1f798afbe4588e6c01105a21 100644 (file)
@@ -235,7 +235,7 @@ asnStats(StoreEntry * sentry)
 static void
 asnCacheStart(int as)
 {
-    // TODO: use class URL instead of generating a string and re-parsing
+    // TODO: use class AnyP::Uri instead of generating a string and re-parsing
     LOCAL_ARRAY(char, asres, 4096);
     StoreEntry *e;
     ASState *asState = new ASState;
index 2100992138b78032cb71ffa6aa6b10e9c0441858..13c15ba2fd67dedfe615bcbd7768db1c96a09b13 100644 (file)
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/DomainData.h"
+#include "anyp/Uri.h"
 #include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
-#include "src/URL.h"
 #include "util.h"
 
 template<class T>
index a01241ff2ff6be7740efecbdfd9a248c1d2fac57..137c8968e622448e07074b0f6997850efcd94a4b 100644 (file)
@@ -22,7 +22,6 @@
 #include "ssl/bio.h"
 #include "ssl/ServerBump.h"
 #include "ssl/support.h"
-#include "URL.h"
 
 // Compare function for tree search algorithms
 static int
index 7bd65d653c3643bed0124820827d08ca9f9fc8d5..442f15f08c5874be225e1063896ec793a8006cac 100644 (file)
@@ -14,7 +14,6 @@
 #include "acl/Url.h"
 #include "HttpRequest.h"
 #include "rfc1738.h"
-#include "src/URL.h"
 
 int
 ACLUrlStrategy::match (ACLData<char const *> * &data, ACLFilledChecklist *checklist)
index 3c868f824057bba4fcf5c0d546e22d724e755d35..17cd55c14833cd0a15c60e5054af22af37530797 100644 (file)
@@ -189,7 +189,7 @@ bool
 Adaptation::ServiceConfig::grokUri(const char *value)
 {
     // TODO: find core code that parses URLs and extracts various parts
-    // AYJ: most of this is duplicate of URL::parse() in src/url.cc
+    // AYJ: most of this is duplicate of AnyP::Uri::parse()
 
     if (!value || !*value) {
         debugs(3, DBG_CRITICAL, HERE << cfg_filename << ':' << config_lineno << ": " <<
index 1db662fd151bba25b87977cde1b57b4ba4beb31b..07e894749f112049d145ca1e1d520350af16fa5f 100644 (file)
@@ -20,7 +20,6 @@
 #include "adaptation/ecap/MessageRep.h"
 #include "adaptation/ecap/XactionRep.h"
 #include "base/TextException.h"
-#include "URL.h"
 
 /* HeaderRep */
 
@@ -199,8 +198,8 @@ Adaptation::Ecap::RequestLineRep::RequestLineRep(HttpRequest &aMessage):
 void
 Adaptation::Ecap::RequestLineRep::uri(const Area &aUri)
 {
-    // TODO: if method is not set, URL::parse will assume it is not connect;
-    // Can we change URL::parse API to remove the method parameter?
+    // TODO: if method is not set, AnyP::Uri::parse will assume it is not connect;
+    // Can we change AnyP::Uri::parse API to remove the method parameter?
     const char *buf = aUri.toString().c_str();
     const bool ok = theMessage.url.parse(theMessage.method, buf);
     Must(ok);
index e981e16e565e7816a657cfd15b5671a0c146cfda..b56a5a62853c21277f0520e9b9e111b41409515f 100644 (file)
@@ -32,7 +32,6 @@
 #include "HttpRequest.h"
 #include "MasterXaction.h"
 #include "SquidTime.h"
-#include "URL.h"
 
 // flow and terminology:
 //     HTTP| --> receive --> encode --> write --> |network
index 6bd41e5d584705f5faa8ab6cd7e2ae14f92ef5a9..a662ae2b9dd38c861af408e95bc544436bb4cab8 100644 (file)
@@ -18,6 +18,8 @@ libanyp_la_SOURCES = \
        ProtocolType.h \
        ProtocolVersion.h \
        TrafficMode.h \
+       Uri.cc \
+       Uri.h \
        UriScheme.cc \
        UriScheme.h
 
similarity index 98%
rename from src/url.cc
rename to src/anyp/Uri.cc
index 44b61522a2a6abc2769b2079c2abd12f87596424..30af7eedaf85b92fbe808e8a1038bef99798e168 100644 (file)
@@ -9,12 +9,12 @@
 /* DEBUG: section 23    URL Parsing */
 
 #include "squid.h"
+#include "anyp/Uri.h"
 #include "globals.h"
 #include "HttpRequest.h"
 #include "rfc1738.h"
 #include "SquidConfig.h"
 #include "SquidString.h"
-#include "URL.h"
 
 static const char valid_hostname_chars_u[] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -30,21 +30,21 @@ static const char valid_hostname_chars[] =
     ;
 
 const SBuf &
-URL::Asterisk()
+AnyP::Uri::Asterisk()
 {
     static SBuf star("*");
     return star;
 }
 
 const SBuf &
-URL::SlashPath()
+AnyP::Uri::SlashPath()
 {
     static SBuf slash("/");
     return slash;
 }
 
 void
-URL::host(const char *src)
+AnyP::Uri::host(const char *src)
 {
     hostAddr_.setEmpty();
     hostAddr_ = src;
@@ -60,7 +60,7 @@ URL::host(const char *src)
 }
 
 const SBuf &
-URL::path() const
+AnyP::Uri::path() const
 {
     // RFC 3986 section 3.3 says path can be empty (path-abempty).
     // RFC 7230 sections 2.7.3, 5.3.1, 5.7.2 - says path cannot be empty, default to "/"
@@ -188,7 +188,7 @@ urlParseProtocol(const char *b)
  * being "end of host with implied path of /".
  */
 bool
-URL::parse(const HttpRequestMethod& method, const char *url)
+AnyP::Uri::parse(const HttpRequestMethod& method, const char *url)
 {
     LOCAL_ARRAY(char, proto, MAX_URL);
     LOCAL_ARRAY(char, login, MAX_URL);
@@ -224,7 +224,7 @@ URL::parse(const HttpRequestMethod& method, const char *url)
                 return false;
 
     } else if ((method == Http::METHOD_OPTIONS || method == Http::METHOD_TRACE) &&
-               URL::Asterisk().cmp(url) == 0) {
+               AnyP::Uri::Asterisk().cmp(url) == 0) {
         parseFinish(AnyP::PROTO_HTTP, nullptr, url, foundHost, SBuf(), 80 /* HTTP default port */);
         return true;
     } else if (strncmp(url, "urn:", 4) == 0) {
@@ -444,7 +444,7 @@ URL::parse(const HttpRequestMethod& method, const char *url)
 
 /// Update the URL object with parsed URI data.
 void
-URL::parseFinish(const AnyP::ProtocolType protocol,
+AnyP::Uri::parseFinish(const AnyP::ProtocolType protocol,
                  const char *const protoStr, // for unknown protocols
                  const char *const aUrlPath,
                  const char *const aHost,
@@ -459,7 +459,7 @@ URL::parseFinish(const AnyP::ProtocolType protocol,
 }
 
 void
-URL::touch()
+AnyP::Uri::touch()
 {
     absolute_.clear();
     authorityHttp_.clear();
@@ -467,7 +467,7 @@ URL::touch()
 }
 
 SBuf &
-URL::authority(bool requirePort) const
+AnyP::Uri::authority(bool requirePort) const
 {
     if (authorityHttp_.isEmpty()) {
 
@@ -485,7 +485,7 @@ URL::authority(bool requirePort) const
 }
 
 SBuf &
-URL::absolute() const
+AnyP::Uri::absolute() const
 {
     if (absolute_.isEmpty()) {
         // TODO: most URL will be much shorter, avoid allocating this much
@@ -774,7 +774,7 @@ urlCheckRequest(const HttpRequest * r)
     // we support OPTIONS and TRACE directed at us (with a 501 reply, for now)
     // we also support forwarding OPTIONS and TRACE, except for the *-URI ones
     if (r->method == Http::METHOD_OPTIONS || r->method == Http::METHOD_TRACE)
-        return (r->header.getInt64(Http::HdrType::MAX_FORWARDS) == 0 || r->url.path() != URL::Asterisk());
+        return (r->header.getInt64(Http::HdrType::MAX_FORWARDS) == 0 || r->url.path() != AnyP::Uri::Asterisk());
 
     if (r->method == Http::METHOD_PURGE)
         return 1;
@@ -928,7 +928,7 @@ URLHostName::extract(char const *aUrl)
     return Host;
 }
 
-URL::URL(AnyP::UriScheme const &aScheme) :
+AnyP::Uri::Uri(AnyP::UriScheme const &aScheme) :
     scheme_(aScheme),
     hostIsNumeric_(false),
     port_(0)
similarity index 90%
rename from src/URL.h
rename to src/anyp/Uri.h
index 97882df03f118f83d84a37c8061a29e37b591a06..5806438e2bb84c21c45859689e3d4884205a5ac7 100644 (file)
--- a/src/URL.h
@@ -6,8 +6,8 @@
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
-#ifndef SQUID_SRC_URL_H
-#define SQUID_SRC_URL_H
+#ifndef SQUID_SRC_ANYP_URI_H
+#define SQUID_SRC_ANYP_URI_H
 
 #include "anyp/UriScheme.h"
 #include "ip/Address.h"
 
 #include <iosfwd>
 
+class HttpRequestMethod;
+
+namespace AnyP
+{
+
 /**
- * The URL class represents a Uniform Resource Location
+ * Represents a Uniform Resource Identifier.
+ * Can store both URL or URN representations.
  *
  * Governed by RFC 3986
  */
-class URL
+class Uri
 {
-    MEMPROXY_CLASS(URL);
+    MEMPROXY_CLASS(Uri);
 
 public:
-    URL() : hostIsNumeric_(false), port_(0) {*host_=0;}
-    URL(AnyP::UriScheme const &aScheme);
-    URL(const URL &other) {
+    Uri() : hostIsNumeric_(false), port_(0) {*host_=0;}
+    Uri(AnyP::UriScheme const &aScheme);
+    Uri(const Uri &other) {
         this->operator =(other);
     }
-    URL &operator =(const URL &o) {
+    Uri &operator =(const Uri &o) {
         scheme_ = o.scheme_;
         userInfo_ = o.userInfo_;
         memcpy(host_, o.host_, sizeof(host_));
@@ -81,7 +87,7 @@ public:
     /// the static '/' default URL-path
     static const SBuf &SlashPath();
 
-    /// the static '*' pseudo-URL
+    /// the static '*' pseudo-URI
     static const SBuf &Asterisk();
 
     /**
@@ -119,14 +125,14 @@ private:
      * 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
+     * a AnyP::UriScheme class instance for each URL scheme we support, and one
      * class for each manner of treating the scheme : a Hierarchical URL, a
      * non-hierarchical URL etc.
      \par
      * Deferring the decision, its a type code for now. RBC 20060507.
      \par
-     * In order to make taking any of these routes easy, scheme is private
-     * and immutable, only settable at construction time,
+     * In order to make taking any of these routes easy, scheme is private,
+     * only settable at construction time, or with explicit setter
      */
     AnyP::UriScheme scheme_;
 
@@ -141,16 +147,18 @@ private:
     unsigned short port_;   ///< URL port
 
     // XXX: for now includes query-string.
-    SBuf path_;     ///< URL path segment
+    SBuf path_;     ///< URI path segment
 
-    // pre-assembled URL forms
+    // pre-assembled URI forms
     mutable SBuf authorityHttp_;     ///< RFC 7230 section 5.3.3 authority, maybe without default-port
     mutable SBuf authorityWithPort_; ///< RFC 7230 section 5.3.3 authority with explicit port
     mutable SBuf absolute_;          ///< RFC 7230 section 5.3.2 absolute-URI
 };
 
+} // namespace AnyP
+
 inline std::ostream &
-operator <<(std::ostream &os, const URL &url)
+operator <<(std::ostream &os, const AnyP::Uri &url)
 {
     // none means explicit empty string for scheme.
     if (url.getScheme() != AnyP::PROTO_NONE)
@@ -166,8 +174,9 @@ operator <<(std::ostream &os, const URL &url)
     return os;
 }
 
+/* Deprecated functions for Legacy code handling URLs */
+
 class HttpRequest;
-class HttpRequestMethod;
 
 void urlInitialize(void);
 char *urlCanonicalClean(const HttpRequest *);
@@ -221,5 +230,5 @@ int urlCheckRequest(const HttpRequest *);
 char *urlHostname(const char *url);
 void urlExtMethodConfigure(void);
 
-#endif /* SQUID_SRC_URL_H_H */
+#endif /* SQUID_SRC_ANYP_URI_H */
 
index dbf4f0cf5a2d31f6a2da2badff2d1ee5bb6b0315..a10759da15a85e8f4b64ea14706c9b9859317e3b 100644 (file)
@@ -17,6 +17,7 @@ namespace AnyP
 class PortCfg;
 typedef RefCount<PortCfg> PortCfgPointer;
 
+class Uri;
 class UriScheme;
 
 } // namespace AnyP
index 3d23feaad5b0f3f92882918b9194e0d04abe023d..dae4674a4ce18f7374fe8adcc44e89d1d61ba5fd 100644 (file)
@@ -15,7 +15,6 @@
 #include "neighbors.h"
 #include "SquidConfig.h"
 #include "Store.h"
-#include "URL.h"
 
 #include <cmath>
 
index 964284e92b6fdbc6a0786886c712828456e7c04e..358d2c50ea42577e7a7b877647c00874f058841e 100644 (file)
 #include "Store.h"
 #include "TimeOrTag.h"
 #include "tools.h"
-#include "URL.h"
 
 #if USE_AUTH
 #include "auth/UserRequest.h"
index b2f0ebd09dfca5fada7468c7fdf31abec700c1b1..4e64c9d22768bcd82550c13e245faee4b8dae98e 100644 (file)
@@ -37,7 +37,6 @@
 #include "Store.h"
 #include "StrList.h"
 #include "tools.h"
-#include "URL.h"
 #if USE_AUTH
 #include "auth/UserRequest.h"
 #endif
index d6e73b4d9042be1478bb94728c8210dcc80294ad..e619392b809012aae36f62cda9ba9581d6f43c52 100644 (file)
@@ -53,7 +53,6 @@
 #include "Store.h"
 #include "StrList.h"
 #include "tools.h"
-#include "URL.h"
 #include "wordlist.h"
 #if USE_AUTH
 #include "auth/UserRequest.h"
@@ -1264,7 +1263,7 @@ ClientRequestContext::clientRedirectDone(const Helper::Reply &reply)
 
             // prevent broken helpers causing too much damage. If old URL == new URL skip the re-write.
             if (urlNote != NULL && strcmp(urlNote, http->uri)) {
-                URL tmpUrl;
+                AnyP::Uri tmpUrl;
                 if (tmpUrl.parse(old_request->method, urlNote)) {
                     HttpRequest *new_request = old_request->clone();
                     new_request->url = tmpUrl;
index c72ec7634099e7d95b5e4a0f785b70529934f5c2..5effc6b363921ef96e48e69cefa5d414af7ba3e7 100644 (file)
@@ -25,7 +25,6 @@
 #include "StatCounters.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 
 #if USE_ADAPTATION
 #include "adaptation/AccessCheck.h"
index 41331ccef6f36cb6c59cbd724201c7c5cf093425..98d40c1fa9b0d5299f9563e5ae964194be294055 100644 (file)
@@ -38,7 +38,6 @@
 #include "StatCounters.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 #include "util.h"
 #include "wordlist.h"
 
index fb4948b535e9edc25ff63373f42d057d75566ac8..84c74ac775f1b8e52efed89be8d8dff620909e54 100644 (file)
@@ -27,7 +27,6 @@
 #include "SquidConfig.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 #include "wordlist.h"
 #if USE_AUTH
 #include "auth/UserRequest.h"
index 97613ea06f0835d2f43641abb5c61bf024daa5f8..54a6fb5e3db4406595b52893a2b28065b9f43283 100644 (file)
@@ -35,7 +35,6 @@
 #include "SquidTime.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 #include "wordlist.h"
 #if USE_OPENSSL
 #include "ssl/ServerBump.h"
index d5d16e0146debf1ba85f568d615ddf8a380b001d..e19efb0bd3788288bbca87a57a371272c912f279 100644 (file)
@@ -27,7 +27,6 @@
 #include "SquidTime.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 #if USE_OPENSSL
 #include "ssl/ErrorDetail.h"
 #include "ssl/ServerBump.h"
index 3f16aec6093ccd9ca4b27c81fa3130cc9c066fd2..66b2aac3d0f47256a3e387cad6316313645d3197 100644 (file)
@@ -35,7 +35,6 @@
 #include "store_key_md5.h"
 #include "StoreClient.h"
 #include "tools.h"
-#include "URL.h"
 
 typedef struct _Countstr Countstr;
 
index 6d60b2051a89e062a479b94c61f454a72ef4e793..1ed98ca2478518ed8dc8bff6d21200c870054a22 100644 (file)
@@ -56,7 +56,6 @@
 #include "Store.h"
 #include "StrList.h"
 #include "tools.h"
-#include "URL.h"
 #include "util.h"
 
 #if USE_AUTH
index 2ef593cfc0a40d47bab8b3969dcbd9933333c90b..c812b605174574ed9354472e86517855d270f987 100644 (file)
@@ -38,7 +38,6 @@
 #include "Store.h"
 #include "StoreClient.h"
 #include "tools.h"
-#include "URL.h"
 #include "wordlist.h"
 
 #if HAVE_SYS_STAT_H
@@ -1095,7 +1094,7 @@ netdbHostData(const char *host, int *samp, int *rtt, int *hops)
 }
 
 void
-netdbUpdatePeer(const URL &url, CachePeer * e, int irtt, int ihops)
+netdbUpdatePeer(const AnyP::Uri &url, CachePeer *e, int irtt, int ihops)
 {
 #if USE_ICMP
     netdbEntry *n;
index 33f57c6623df93bacfe930726f503df3dd08ec42..67f64a37e94e94ee144a8ee5ca207039b426df86 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef ICMP_NET_DB_H
 #define ICMP_NET_DB_H
 
+#include "anyp/forward.h"
 #include "hash.h"
 #include "ip/forward.h"
 #include "mem/forward.h"
@@ -17,7 +18,6 @@ class CachePeer;
 class HttpRequest;
 class netdbEntry;
 class StoreEntry;
-class URL;
 
 class net_db_name:
     public hash_link /* must be first */
@@ -73,7 +73,7 @@ void netdbDump(StoreEntry *);
 void netdbFreeMemory(void);
 int netdbHostHops(const char *host);
 int netdbHostRtt(const char *host);
-void netdbUpdatePeer(const URL &, CachePeer * e, int rtt, int hops);
+void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops);
 
 void netdbDeleteAddrNetwork(Ip::Address &addr);
 void netdbBinaryExchange(StoreEntry *);
index 19fedf08f545d2ae921676f08ea8afe34ef5c8b6..6ebc7a67937980cad3e68279db6de8915efcb6ac 100644 (file)
@@ -20,7 +20,6 @@
 #include "SquidTime.h"
 #include "Store.h"
 #include "tools.h"
-#include "URL.h"
 #include "util.h"
 #include "wordlist.h"
 
@@ -108,7 +107,7 @@ internalRemoteUri(const char *host, unsigned short port, const char *dir, const
                 strlen(lc_host) - 1);
 
     /* build URI */
-    URL tmp(AnyP::PROTO_HTTP);
+    AnyP::Uri tmp(AnyP::PROTO_HTTP);
     tmp.host(lc_host);
     if (port)
         tmp.port(port);
index 19f096fe4457e5b835d8f8c1fad6bdb16c8b8fcc..2a7269edcd7d642e1fa93dbbbd62aaf63a80aaea 100644 (file)
@@ -78,7 +78,6 @@
 #include "StoreFileSystem.h"
 #include "tools.h"
 #include "unlinkd.h"
-#include "URL.h"
 #include "wccp.h"
 #include "wccp2.h"
 #include "WinSvc.h"
index b943a24d2090b6fdd05b6f420bc2314ac5806487..30ed5bcce861c6cfdee058f773f6898d8959438d 100644 (file)
@@ -44,7 +44,6 @@
 #include "Store.h"
 #include "store_key_md5.h"
 #include "tools.h"
-#include "URL.h"
 
 /* count mcast group peers every 15 minutes */
 #define MCAST_COUNT_RATE 900
@@ -111,7 +110,7 @@ whichPeer(const Ip::Address &from)
 }
 
 peer_t
-neighborType(const CachePeer * p, const URL &url)
+neighborType(const CachePeer * p, const AnyP::Uri &url)
 {
 
     const NeighborTypeDomainList *d = NULL;
@@ -1374,7 +1373,7 @@ peerCountMcastPeersStart(void *data)
     MemObject *mem;
     icp_common_t *query;
     int reqnum;
-    // TODO: use class URL instead of constructing and re-parsing a string
+    // TODO: use class AnyP::Uri instead of constructing and re-parsing a string
     LOCAL_ARRAY(char, url, MAX_URL);
     assert(p->type == PEER_MULTICAST);
     p->mcast.flags.count_event_pending = false;
index 5edd315b8e8f3ccd3f51f7f7048ef787cc588196..1d9bd5ab2abdb09e3494ecf2b5bc966adcd834be 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef SQUID_NEIGHBORS_H_
 #define SQUID_NEIGHBORS_H_
 
+#include "anyp/forward.h"
 #include "enums.h"
 #include "ICP.h"
 #include "lookup_t.h"
@@ -20,7 +21,6 @@ class HttpRequest;
 class HttpRequestMethod;
 class CachePeer;
 class StoreEntry;
-class URL;
 
 CachePeer *getFirstPeer(void);
 CachePeer *getFirstUpParent(HttpRequest *);
@@ -54,7 +54,7 @@ void peerNoteDigestLookup(HttpRequest * request, CachePeer * p, lookup_t lookup)
 void peerNoteDigestGone(CachePeer * p);
 int neighborUp(const CachePeer * e);
 const char *neighborTypeStr(const CachePeer * e);
-peer_t neighborType(const CachePeer *, const URL &);
+peer_t neighborType(const CachePeer *, const AnyP::Uri &);
 void peerConnectFailed(CachePeer *);
 void peerConnectSucceded(CachePeer *);
 void dump_peer_options(StoreEntry *, CachePeer *);
index 87e73ec0c0500b59c34646dc900cebd803bc9208..94c83881a3ce6e4b958086d284b66b8ea96fac11 100644 (file)
@@ -33,7 +33,6 @@
 #include "SquidConfig.h"
 #include "SquidTime.h"
 #include "Store.h"
-#include "URL.h"
 
 static struct {
     int timeouts;
index 3af4059ed0af2dbccbd79502a79613dcfdc71491..2dff9c1eaddfbcc33f3a20f99718cf4eb82da824 100644 (file)
@@ -22,7 +22,6 @@
 #include "SquidConfig.h"
 #include "SquidTime.h"
 #include "Store.h"
-#include "URL.h"
 #include "util.h"
 
 typedef enum {
index 0a1ee43ec6541c304c3bcc03cb5023fd82f0f9a3..c6ffa94fb6c5cdab2989e4b142e372104c81a60b 100644 (file)
@@ -339,7 +339,7 @@ Ftp::Server::resetLogin(const char *reason)
 void
 Ftp::Server::calcUri(const SBuf *file)
 {
-    // TODO: fill a class URL instead of string
+    // TODO: fill a class AnyP::Uri instead of string
     uri = "ftp://";
     uri.append(host);
     if (port->ftp_track_dirs && master->workingDir.length()) {
index 1c8d61a08f1d403d569bc563ecf5b1175d733754..d5d255398fccb40f2c453d9fc313188447ee715c 100644 (file)
@@ -9,14 +9,13 @@
 /* DEBUG: section 33    Client-side Routines */
 
 #include "squid.h"
-
+#include "anyp/Uri.h"
 #include "client_side.h"
 #include "FwdState.h"
 #include "http/Stream.h"
 #include "ssl/ServerBump.h"
 #include "Store.h"
 #include "StoreClient.h"
-#include "URL.h"
 
 CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump);
 
index 8c9647d061ef7f90322e7c7a893a8d32211ce128..e2cb85264123fd0fdbc7e1f4eede22ed8b765616 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "acl/FilledChecklist.h"
 #include "anyp/PortCfg.h"
+#include "anyp/Uri.h"
 #include "fatal.h"
 #include "fd.h"
 #include "fde.h"
@@ -31,7 +32,6 @@
 #include "ssl/ErrorDetail.h"
 #include "ssl/gadgets.h"
 #include "ssl/support.h"
-#include "URL.h"
 
 #include <cerrno>
 
index b4cde67bbc141c027266f8c190abfdc9b4eeaa21..e80a788111ea0e64e58a68c55e404507024604f8 100644 (file)
@@ -12,7 +12,6 @@
 #include "HttpRequest.h"
 #include "md5.h"
 #include "store_key_md5.h"
-#include "URL.h"
 
 static cache_key null_key[SQUID_MD5_DIGEST_LENGTH];
 
index ad48516c0586f038a37c037c50403a5762eee149..a7cc13b955cec58b39fd348c66cf60a35d8581ff 100644 (file)
@@ -41,6 +41,7 @@ STUB_SOURCE= tests/STUB.h \
        tests/stub_ipc.cc \
        tests/stub_ipc_Forwarder.cc \
        tests/stub_ipc_TypedMsgHdr.cc \
+       tests/stub_libanyp.cc \
        tests/stub_libauth_acls.cc \
        tests/stub_libauth.cc \
        tests/stub_libcomm.cc \
diff --git a/src/tests/stub_libanyp.cc b/src/tests/stub_libanyp.cc
new file mode 100644 (file)
index 0000000..0a7d347
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+
+#define STUB_API "anyp/libanyp.la"
+#include "tests/STUB.h"
+
+#include "anyp/Uri.h"
+AnyP::Uri::Uri(AnyP::UriScheme const &) {STUB}
+void AnyP::Uri::touch() STUB
+bool AnyP::Uri::parse(const HttpRequestMethod&, const char *) STUB_RETVAL(true)
+void AnyP::Uri::host(const char *) STUB
+static SBuf nil;
+const SBuf &AnyP::Uri::path() const STUB_RETVAL(nil)
+const SBuf &AnyP::Uri::SlashPath()
+{
+    static SBuf slash("/");
+    return slash;
+}
+const SBuf &AnyP::Uri::Asterisk()
+{
+    static SBuf asterisk("*");
+    return asterisk;
+}
+SBuf &AnyP::Uri::authority(bool) const STUB_RETVAL(nil)
+SBuf &AnyP::Uri::absolute() const STUB_RETVAL(nil)
+void urlInitialize() STUB
+char *urlCanonicalClean(const HttpRequest *) STUB_RETVAL(nullptr)
+const char *urlCanonicalFakeHttps(const HttpRequest *) STUB_RETVAL(nullptr)
+bool urlIsRelative(const char *) STUB_RETVAL(false)
+char *urlMakeAbsolute(const HttpRequest *, const char *)STUB_RETVAL(nullptr)
+char *urlRInternal(const char *, unsigned short, const char *, const char *) STUB_RETVAL(nullptr)
+char *urlInternal(const char *, const char *) STUB_RETVAL(nullptr)
+int matchDomainName(const char *, const char *, uint) STUB_RETVAL(0)
+int urlCheckRequest(const HttpRequest *) STUB_RETVAL(0)
+char *urlHostname(const char *) STUB_RETVAL(nullptr)
+void urlExtMethodConfigure() STUB
+
index d9f716c2713c3b112bceaec50f0569f19a2569e8..4f65eaf81eeb1e4e44eb17192bfb17d7a8567263 100644 (file)
@@ -30,7 +30,7 @@ void netdbDump(StoreEntry *) STUB
 void netdbFreeMemory(void) STUB
 int netdbHostHops(const char *host) STUB_RETVAL(-1)
 int netdbHostRtt(const char *host) STUB_RETVAL(-1)
-void netdbUpdatePeer(const URL &, CachePeer * e, int rtt, int hops) STUB
+void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int, int) STUB
 void netdbDeleteAddrNetwork(Ip::Address &addr) STUB
 void netdbBinaryExchange(StoreEntry *) STUB
 void netdbExchangeStart(void *) STUB
index de6b59610fdbbfa8c95d87a09615e9e12ffe6d0d..5168dc7446c3f527612a007097476c1167f43e68 100644 (file)
 
 #include <cppunit/TestAssert.h>
 
+#include "anyp/Uri.h"
 #include "Debug.h"
-#include "testURL.h"
+#include "tests/testURL.h"
 #include "unitTestMain.h"
-#include "URL.h"
 
 #include <sstream>
 
@@ -36,11 +36,11 @@ void
 testURL::testConstructScheme()
 {
     AnyP::UriScheme empty_scheme;
-    URL protoless_url(AnyP::PROTO_NONE);
+    AnyP::Uri protoless_url(AnyP::PROTO_NONE);
     CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
 
     AnyP::UriScheme ftp_scheme(AnyP::PROTO_FTP);
-    URL ftp_url(AnyP::PROTO_FTP);
+    AnyP::Uri ftp_url(AnyP::PROTO_FTP);
     CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
 }
 
@@ -53,10 +53,10 @@ void
 testURL::testDefaultConstructor()
 {
     AnyP::UriScheme aScheme;
-    URL aUrl;
+    AnyP::Uri aUrl;
     CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
 
-    URL *urlPointer = new URL;
+    auto *urlPointer = new AnyP::Uri;
     CPPUNIT_ASSERT(urlPointer != NULL);
     delete urlPointer;
 }
index a5fb7e482b6b5960e4d14f5364e2ef862437f8a3..d3ad7cf928b69afe646abfe12b668279694b86b9 100644 (file)
@@ -23,7 +23,6 @@
 #include "Store.h"
 #include "StoreClient.h"
 #include "tools.h"
-#include "URL.h"
 #include "urn.h"
 
 #define URN_REQBUF_SZ   4096
@@ -145,7 +144,7 @@ UrnState::setUriResFromRequest(HttpRequest *r)
     }
 
     SBuf uri = r->url.path();
-    // TODO: use class URL instead of generating a string and re-parsing
+    // TODO: use class AnyP::Uri instead of generating a string and re-parsing
     LOCAL_ARRAY(char, local_urlres, 4096);
     char *host = getHost(uri);
     snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:" SQUIDSBUFPH, host, SQUIDSBUFPRINT(uri));