]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Redesign urlParse API part2: fix compile errors after r15191
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 12 Jun 2017 19:28:29 +0000 (22:28 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 12 Jun 2017 19:28:29 +0000 (22:28 +0300)
src/url.cc

index 3027019ef0670e890aa7519862a14f0b90ad5a77..0a5e3053578e88b2e489c84a3c3064ed6f4ed439 100644 (file)
@@ -217,14 +217,14 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
         /* terminate so it doesn't overflow other buffers */
         *(url + (MAX_URL >> 1)) = '\0';
         debugs(23, DBG_IMPORTANT, "urlParse: URL too large (" << l << " bytes)");
-        return NULL;
+        return false;
     }
     if (method == Http::METHOD_CONNECT) {
         port = CONNECT_PORT;
 
         if (sscanf(url, "[%[^]]]:%d", host, &port) < 1)
             if (sscanf(url, "%[^:]:%d", host, &port) < 1)
-                return NULL;
+                return false;
 
     } else if ((method == Http::METHOD_OPTIONS || method == Http::METHOD_TRACE) &&
                URL::Asterisk().cmp(url) == 0) {
@@ -242,12 +242,12 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
             *dst = *src;
         }
         if (i >= l)
-            return NULL;
+            return false;
         *dst = '\0';
 
         /* Then its :// */
         if ((i+3) > l || *src != ':' || *(src + 1) != '/' || *(src + 2) != '/')
-            return NULL;
+            return false;
         i += 3;
         src += 3;
 
@@ -265,7 +265,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
          * been -given- a valid URL and the path is just '/'.
          */
         if (i > l)
-            return NULL;
+            return false;
         *dst = '\0';
 
         // bug 3074: received 'path' starting with '?', '#', or '\0' implies '/'
@@ -282,7 +282,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
 
         /* We -could- be at the end of the buffer here */
         if (i > l)
-            return NULL;
+            return false;
         /* If the URL path is empty we set it to be "/" */
         if (dst == urlpath) {
             *dst = '/';
@@ -341,7 +341,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
         // Bug 3183 sanity check: If scheme is present, host must be too.
         if (protocol != AnyP::PROTO_NONE && host[0] == '\0') {
             debugs(23, DBG_IMPORTANT, "SECURITY ALERT: Missing hostname in URL '" << url << "'. see access.log for details.");
-            return NULL;
+            return false;
         }
 
         if (t && *t == ':') {
@@ -372,7 +372,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
 
     if (Config.onoff.check_hostnames && strspn(host, Config.onoff.allow_underscore ? valid_hostname_chars_u : valid_hostname_chars) != strlen(host)) {
         debugs(23, DBG_IMPORTANT, "urlParse: Illegal character in hostname '" << host << "'");
-        return NULL;
+        return false;
     }
 
     /* For IPV6 addresses also check for a colon */
@@ -386,12 +386,12 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
     /* reject duplicate or leading dots */
     if (strstr(host, "..") || *host == '.') {
         debugs(23, DBG_IMPORTANT, "urlParse: Illegal hostname '" << host << "'");
-        return NULL;
+        return false;
     }
 
     if (port < 1 || port > 65535) {
         debugs(23, 3, "urlParse: Invalid port '" << port << "'");
-        return NULL;
+        return false;
     }
 
 #if HARDCODE_DENY_PORTS
@@ -399,7 +399,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
      * maybe someone wants them hardcoded... */
     if (port == 7 || port == 9 || port == 19) {
         debugs(23, DBG_CRITICAL, "urlParse: Deny access to port " << port);
-        return NULL;
+        return false;
     }
 #endif
 
@@ -409,7 +409,7 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest &request)
         switch (Config.uri_whitespace) {
 
         case URI_WHITESPACE_DENY:
-            return NULL;
+            return false;
 
         case URI_WHITESPACE_ALLOW:
             break;