CoAP protocol drafts are progressing and it is likely there will be implementations within the year.

This will make Squid happy with HTTP requests using coap:/ /and coaps:// URI. No gateway or other interaction with CoAP is enabled.

Amos

=== modified file 'src/anyp/ProtocolType.h'
--- src/anyp/ProtocolType.h     2011-03-03 01:18:42 +0000
+++ src/anyp/ProtocolType.h     2012-02-07 10:54:09 +0000
@@ -1,40 +1,42 @@
 #ifndef _SQUID_SRC_ANYP_PROTOCOLTYPE_H
 #define _SQUID_SRC_ANYP_PROTOCOLTYPE_H
 
 #if HAVE_OSTREAM
 #include <ostream>
 #endif
 
 namespace AnyP
 {
 
 /**
  * List of all protocols known and supported.
  * This is a combined list. It is used as type-codes where needed and
  * the AnyP::ProtocolType_Str array of strings may be used for display
  */
 typedef enum {
     PROTO_NONE = 0,
     PROTO_HTTP,
     PROTO_FTP,
     PROTO_HTTPS,
+    PROTO_COAP,
+    PROTO_COAPS,
     PROTO_GOPHER,
     PROTO_WAIS,
     PROTO_CACHE_OBJECT,
     PROTO_ICP,
 #if USE_HTCP
     PROTO_HTCP,
 #endif
     PROTO_URN,
     PROTO_WHOIS,
     PROTO_INTERNAL,
     PROTO_ICY,
     PROTO_UNKNOWN,
     PROTO_MAX
 } ProtocolType;
 
 extern const char *ProtocolType_str[];
 
 /** Display the registered Protocol Type (in upper case).
  *  If the protocol is not a registered AnyP::ProtocolType nothing will be 
displayed.
  * The caller is responsible for any alternative text.

=== modified file 'src/url.cc'
--- src/url.cc  2012-01-20 18:55:04 +0000
+++ src/url.cc  2012-02-07 11:00:23 +0000
@@ -108,75 +108,87 @@
 
     if (NULL == e)
         e = b + strcspn(b, ":");
 
     int len = e - b;
 
     /* test common stuff first */
 
     if (strncasecmp(b, "http", len) == 0)
         return AnyP::PROTO_HTTP;
 
     if (strncasecmp(b, "ftp", len) == 0)
         return AnyP::PROTO_FTP;
 
     if (strncasecmp(b, "https", len) == 0)
         return AnyP::PROTO_HTTPS;
 
     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;
 
     if (strncasecmp(b, "wais", len) == 0)
         return AnyP::PROTO_WAIS;
 
     if (strncasecmp(b, "cache_object", len) == 0)
         return AnyP::PROTO_CACHE_OBJECT;
 
     if (strncasecmp(b, "urn", len) == 0)
         return AnyP::PROTO_URN;
 
     if (strncasecmp(b, "whois", len) == 0)
         return AnyP::PROTO_WHOIS;
 
     if (strncasecmp(b, "internal", len) == 0)
         return AnyP::PROTO_INTERNAL;
 
     return AnyP::PROTO_NONE;
 }
 
 int
 urlDefaultPort(AnyP::ProtocolType p)
 {
     switch (p) {
 
     case AnyP::PROTO_HTTP:
         return 80;
 
     case AnyP::PROTO_HTTPS:
         return 443;
 
     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;
 
     case AnyP::PROTO_WAIS:
         return 210;
 
     case AnyP::PROTO_CACHE_OBJECT:
 
     case AnyP::PROTO_INTERNAL:
         return CACHE_HTTP_PORT;
 
     case AnyP::PROTO_WHOIS:
         return 43;
 
     default:
         return 0;
     }
 }
 
 /*

Reply via email to