From: Amos Jeffries Date: Fri, 16 Mar 2012 06:19:24 +0000 (-0600) Subject: Support CoAP over HTTP X-Git-Tag: SQUID_3_1_20~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ba083a7c078293ce7a2f1a10f4da27e7fe6a104;p=thirdparty%2Fsquid.git 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. --- diff --git a/src/enums.h b/src/enums.h index 9c0f2dcde2..f974ef863c 100644 --- a/src/enums.h +++ b/src/enums.h @@ -250,6 +250,8 @@ typedef enum { PROTO_NONE, PROTO_HTTP, PROTO_FTP, + PROTO_COAP, + PROTO_COAPS, PROTO_GOPHER, PROTO_WAIS, PROTO_CACHEOBJ, diff --git a/src/url.cc b/src/url.cc index 5a4204b3f1..734a81a3dd 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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;