]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support CoAP-over-HTTP
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 17 Feb 2012 09:01:51 +0000 (02:01 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 17 Feb 2012 09:01:51 +0000 (02:01 -0700)
Make Squid happy with HTTP requests using coap:// and coaps:// URI.

No gateway or other interaction with CoAP is enabled by this patch.

src/anyp/ProtocolType.h
src/url.cc

index 8a43b39fadc18ed7150f49e7e75ccbf94928133f..4f5ab3b753f1f8c5b5a05628c16fde7819c480a8 100644 (file)
@@ -18,6 +18,8 @@ typedef enum {
     PROTO_HTTP,
     PROTO_FTP,
     PROTO_HTTPS,
+    PROTO_COAP,
+    PROTO_COAPS,
     PROTO_GOPHER,
     PROTO_WAIS,
     PROTO_CACHE_OBJECT,
index 8c485f255507316b7d054107b5caad9df1b4d767..2f1eeb594c5ca9fcce513d07f978fc8db3bac244 100644 (file)
@@ -125,6 +125,12 @@ urlParseProtocol(const char *b, const char *e)
     if (strncasecmp(b, "file", len) == 0)
         return AnyP::PROTO_FTP;
 
+    if (strncasecmp(b, "coap", len) == 0)
+        return AnyP::PROTO_COAP;
+
+    if (strncasecmp(b, "coaps", len) == 0)
+        return AnyP::PROTO_COAPS;
+
     if (strncasecmp(b, "gopher", len) == 0)
         return AnyP::PROTO_GOPHER;
 
@@ -160,6 +166,12 @@ urlDefaultPort(AnyP::ProtocolType p)
     case AnyP::PROTO_FTP:
         return 21;
 
+    case AnyP::PROTO_COAP:
+    case AnyP::PROTO_COAPS:
+        // coaps:// default is TBA as of draft-ietf-core-coap-08.
+        // Assuming IANA policy of allocating same port for base and TLS protocol versions will occur.
+        return 5683;
+
     case AnyP::PROTO_GOPHER:
         return 70;