mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05: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:
parent
98d569bbf5
commit
400d297a92
@ -120,7 +120,7 @@ int client_read_bytes (client_t *client, void *buf, unsigned len)
|
|||||||
if (client->refbuf->len < len)
|
if (client->refbuf->len < len)
|
||||||
len = client->refbuf->len;
|
len = client->refbuf->len;
|
||||||
memcpy (buf, client->refbuf->data, len);
|
memcpy (buf, client->refbuf->data, len);
|
||||||
if (client->refbuf->len < len)
|
if (len < client->refbuf->len)
|
||||||
{
|
{
|
||||||
char *ptr = client->refbuf->data;
|
char *ptr = client->refbuf->data;
|
||||||
memmove (ptr, ptr+len, client->refbuf->len - len);
|
memmove (ptr, ptr+len, client->refbuf->len - len);
|
||||||
|
@ -765,10 +765,14 @@ static void _handle_source_request (client_t *client, char *uri, int auth_style)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
refbuf_t *ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
|
||||||
client->respcode = 200;
|
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");
|
"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);
|
fserve_add_client_callback (client, source_client_callback, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1200,6 +1200,7 @@ void source_client_callback (client_t *client, void *arg)
|
|||||||
{
|
{
|
||||||
const char *agent;
|
const char *agent;
|
||||||
source_t *source = arg;
|
source_t *source = arg;
|
||||||
|
refbuf_t *old_data = client->refbuf;
|
||||||
|
|
||||||
if (client->con->error)
|
if (client->con->error)
|
||||||
{
|
{
|
||||||
@ -1210,6 +1211,9 @@ void source_client_callback (client_t *client, void *arg)
|
|||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
client->refbuf = old_data->associated;
|
||||||
|
old_data->associated = NULL;
|
||||||
|
refbuf_release (old_data);
|
||||||
stats_event (source->mount, "source_ip", source->client->con->ip);
|
stats_event (source->mount, "source_ip", source->client->con->ip);
|
||||||
agent = httpp_getvar (source->client->parser, "user-agent");
|
agent = httpp_getvar (source->client->parser, "user-agent");
|
||||||
if (agent)
|
if (agent)
|
||||||
|
Loading…
Reference in New Issue
Block a user