Commit d6908eb0 authored by Philipp Schafft's avatar Philipp Schafft 🦁

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.
parent 9cf6d931
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment