From dd6072d1f377d858797586b2a7d15b29c10eba5d Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 24 Feb 2012 21:28:08 -0700 Subject: [PATCH] Support CoAP over HTTP 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 | 2 ++ src/url.cc | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/anyp/ProtocolType.h b/src/anyp/ProtocolType.h index 8a43b39fad..4f5ab3b753 100644 --- a/src/anyp/ProtocolType.h +++ b/src/anyp/ProtocolType.h @@ -18,6 +18,8 @@ typedef enum { PROTO_HTTP, PROTO_FTP, PROTO_HTTPS, + PROTO_COAP, + PROTO_COAPS, PROTO_GOPHER, PROTO_WAIS, PROTO_CACHE_OBJECT, diff --git a/src/url.cc b/src/url.cc index 8c485f2555..2f1eeb594c 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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; -- 2.47.2