]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support CoAP over HTTP
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 16 Mar 2012 06:19:24 +0000 (00:19 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 16 Mar 2012 06:19:24 +0000 (00:19 -0600)
Make Squid happy with HTTP requests using coap:// and coaps:// URI.

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

src/enums.h
src/url.cc

index 9c0f2dcde23d8103506b9d0e6fef219ffdd9994e..f974ef863c6672f4815249b2828852fa912f858b 100644 (file)
@@ -250,6 +250,8 @@ typedef enum {
     PROTO_NONE,
     PROTO_HTTP,
     PROTO_FTP,
+    PROTO_COAP,
+    PROTO_COAPS,
     PROTO_GOPHER,
     PROTO_WAIS,
     PROTO_CACHEOBJ,
index 5a4204b3f12b0e25d9851ae2fa2ebb89de4b91a7..734a81a3dd1be744ee0f5da169c7feaf4bbd6905 100644 (file)
@@ -124,6 +124,12 @@ urlParseProtocol(const char *b, const char *e)
     if (strncasecmp(b, "file", len) == 0)
         return 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 PROTO_GOPHER;
 
@@ -159,6 +165,12 @@ urlDefaultPort(protocol_t p)
     case 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 PROTO_GOPHER:
         return 70;