libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit da74226baa1b9c42a18f2c228efbfd6f569dbf59
parent bb9de15b30d7f49dc661d2b306c192b4b50e2bce
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 18 Sep 2010 05:17:21 +0000

experimental SHOUTcast support

Diffstat:
MChangeLog | 3+++
Msrc/daemon/connection.c | 16++++++++++------
Msrc/include/microhttpd.h | 7+++++++
3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Sat Sep 18 07:16:30 CEST 2010 + Adding support for SHOUTcast. -CG + Wed Sep 15 09:33:46 CEST 2010 Fixed double-free. -CG/ES diff --git a/src/daemon/connection.c b/src/daemon/connection.c @@ -588,6 +588,7 @@ build_header_response (struct MHD_Connection *connection) char *data; enum MHD_ValueKind kind; const char *reason_phrase; + uint32_t rc; EXTRA_CHECK (NULL != connection->version); if (0 == strlen(connection->version)) @@ -602,14 +603,17 @@ build_header_response (struct MHD_Connection *connection) if (connection->state == MHD_CONNECTION_FOOTERS_RECEIVED) { add_extra_headers (connection); - reason_phrase = MHD_get_reason_phrase_for (connection->responseCode); + rc = connection->responseCode & (~MHD_ICY_FLAG); + reason_phrase = MHD_get_reason_phrase_for (rc); SPRINTF (code, "%s %u %s\r\n", - (0 == strcasecmp (MHD_HTTP_VERSION_1_0, - connection->version)) - ? MHD_HTTP_VERSION_1_0 - : MHD_HTTP_VERSION_1_1, - connection->responseCode, + (0 != (connection->responseCode & MHD_ICY_FLAG)) + ? "ICY" + : ( (0 == strcasecmp (MHD_HTTP_VERSION_1_0, + connection->version)) + ? MHD_HTTP_VERSION_1_0 + : MHD_HTTP_VERSION_1_1_), + rc, reason_phrase); off = strlen (code); /* estimate size */ diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -190,6 +190,13 @@ extern "C" #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 #define MHD_HTTP_NOT_EXTENDED 510 +/** + * Flag to be "OR"ed with MHD_HTTP status code for + * SHOUTcast. This will cause the response to begin + * with the SHOUTcast "ICY" line instad of "HTTP". + */ +#define MHD_ICY_FLAG ((uint32_t)(1 << 31)) + /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ #define MHD_HTTP_HEADER_ACCEPT "Accept" #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"