From d6908eb0245811264b0f269084f1e6c8d520959c Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Tue, 10 Feb 2015 09:12:33 +0000 Subject: [PATCH] Fix/Cleanup: Answer SOURCE/PUT requests with a real 200-OK. We have answered SOURCE/PUT requests with a simple "HTTP/1.0 200 OK\r\n\r\n" while we should answer with complet headers. This commit corrects this. Interoperability: This will work for two classes of clients: * Super dumb ones not checking the response and will just send data and hope the socket is still open. * Those with a real parser. * Shoutcast clients (indepnded code path). * All libshout, curl, wget, ... based clients. This *could* break: * Clients that check for the exact returned message. However as we start with the same string this should work. Only client that check for the string including the End-of-header CRLF sequense may break. Please test careful before release. --- src/connection.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/connection.c b/src/connection.c index c868feeb..54f8f2eb 100644 --- a/src/connection.c +++ b/src/connection.c @@ -882,8 +882,7 @@ static inline void source_startup(client_t *client, const char *uri) } else { refbuf_t *ok = refbuf_new(PER_CLIENT_REFBUF_SIZE); client->respcode = 200; - snprintf(ok->data, PER_CLIENT_REFBUF_SIZE, - "HTTP/1.0 200 OK\r\n\r\n"); + util_http_build_header(ok->data, PER_CLIENT_REFBUF_SIZE, 0, 0, 200, NULL, NULL, NULL, "", NULL, client); ok->len = strlen(ok->data); /* we may have unprocessed data read in, so don't overwrite it */ ok->associated = client->refbuf;