1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

merge fix, oddcast (maybe other shoutcast source clients) don't wait for OK

response, so we may have surplus data already read, so keep it.

svn path=/icecast/trunk/icecast/; revision=9772
This commit is contained in:
Karl Heyes 2005-08-18 20:37:35 +00:00
parent 98d569bbf5
commit 400d297a92
3 changed files with 11 additions and 3 deletions

View File

@ -120,7 +120,7 @@ int client_read_bytes (client_t *client, void *buf, unsigned len)
if (client->refbuf->len < len)
len = client->refbuf->len;
memcpy (buf, client->refbuf->data, len);
if (client->refbuf->len < len)
if (len < client->refbuf->len)
{
char *ptr = client->refbuf->data;
memmove (ptr, ptr+len, client->refbuf->len - len);

View File

@ -765,10 +765,14 @@ static void _handle_source_request (client_t *client, char *uri, int auth_style)
}
else
{
refbuf_t *ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->respcode = 200;
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
snprintf (ok->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n\r\n");
client->refbuf->len = strlen (client->refbuf->data);
ok->len = strlen (ok->data);
/* we may have unprocessed data read in, so don't overwrite it */
ok->associated = client->refbuf;
client->refbuf = ok;
fserve_add_client_callback (client, source_client_callback, source);
}
}

View File

@ -1200,6 +1200,7 @@ void source_client_callback (client_t *client, void *arg)
{
const char *agent;
source_t *source = arg;
refbuf_t *old_data = client->refbuf;
if (client->con->error)
{
@ -1210,6 +1211,9 @@ void source_client_callback (client_t *client, void *arg)
client_destroy (client);
return;
}
client->refbuf = old_data->associated;
old_data->associated = NULL;
refbuf_release (old_data);
stats_event (source->mount, "source_ip", source->client->con->ip);
agent = httpp_getvar (source->client->parser, "user-agent");
if (agent)