mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Cleanup: Removed now useless start-of-stream passing code (as much as I found. There is more)
This commit is contained in:
parent
b8ceef2425
commit
59cf2ff426
@ -79,7 +79,6 @@
|
|||||||
typedef struct client_queue_tag {
|
typedef struct client_queue_tag {
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int offset;
|
int offset;
|
||||||
int stream_offset;
|
|
||||||
int shoutcast;
|
int shoutcast;
|
||||||
char *shoutcast_mount;
|
char *shoutcast_mount;
|
||||||
char *bodybuffer;
|
char *bodybuffer;
|
||||||
@ -537,6 +536,7 @@ static void process_request_queue (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
ssize_t stream_offset = -1;
|
||||||
int pass_it = 1;
|
int pass_it = 1;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
@ -558,23 +558,27 @@ static void process_request_queue (void)
|
|||||||
* http style headers, we don't want to lose those */
|
* http style headers, we don't want to lose those */
|
||||||
ptr = strstr(client->refbuf->data, "\r\r\n\r\r\n");
|
ptr = strstr(client->refbuf->data, "\r\r\n\r\r\n");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
node->stream_offset = (ptr+6) - client->refbuf->data;
|
stream_offset = (ptr+6) - client->refbuf->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr = strstr(client->refbuf->data, "\r\n\r\n");
|
ptr = strstr(client->refbuf->data, "\r\n\r\n");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
node->stream_offset = (ptr+4) - client->refbuf->data;
|
stream_offset = (ptr+4) - client->refbuf->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr = strstr(client->refbuf->data, "\n\n");
|
ptr = strstr(client->refbuf->data, "\n\n");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
node->stream_offset = (ptr+2) - client->refbuf->data;
|
stream_offset = (ptr+2) - client->refbuf->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pass_it = 0;
|
pass_it = 0;
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
if (pass_it) {
|
if (pass_it) {
|
||||||
|
if (stream_offset != -1) {
|
||||||
|
connection_read_put_back(client->con, client->refbuf->data + stream_offset, node->offset - stream_offset);
|
||||||
|
node->offset = stream_offset;
|
||||||
|
}
|
||||||
if ((client_queue_t **)_req_queue_tail == &(node->next))
|
if ((client_queue_t **)_req_queue_tail == &(node->next))
|
||||||
_req_queue_tail = (volatile client_queue_t **)node_ref;
|
_req_queue_tail = (volatile client_queue_t **)node_ref;
|
||||||
*node_ref = node->next;
|
*node_ref = node->next;
|
||||||
@ -923,8 +927,7 @@ static inline void source_startup(client_t *client, const char *uri)
|
|||||||
ret = util_http_build_header(ok->data, PER_CLIENT_REFBUF_SIZE, 0, 0, status_to_send, NULL, NULL, NULL, NULL, NULL, client);
|
ret = util_http_build_header(ok->data, PER_CLIENT_REFBUF_SIZE, 0, 0, status_to_send, NULL, NULL, NULL, NULL, NULL, client);
|
||||||
snprintf(ok->data + ret, PER_CLIENT_REFBUF_SIZE - ret, "Content-Length: 0\r\n\r\n");
|
snprintf(ok->data + ret, PER_CLIENT_REFBUF_SIZE - ret, "Content-Length: 0\r\n\r\n");
|
||||||
ok->len = strlen(ok->data);
|
ok->len = strlen(ok->data);
|
||||||
/* we may have unprocessed data read in, so don't overwrite it */
|
refbuf_release(client->refbuf);
|
||||||
ok->associated = client->refbuf;
|
|
||||||
client->refbuf = ok;
|
client->refbuf = ok;
|
||||||
fserve_add_client_callback(client, source_client_callback, source);
|
fserve_add_client_callback(client, source_client_callback, source);
|
||||||
}
|
}
|
||||||
@ -1189,11 +1192,6 @@ static void _handle_shoutcast_compatible(client_queue_t *node)
|
|||||||
parser = httpp_create_parser();
|
parser = httpp_create_parser();
|
||||||
httpp_initialize(parser, NULL);
|
httpp_initialize(parser, NULL);
|
||||||
if (httpp_parse(parser, http_compliant, strlen(http_compliant))) {
|
if (httpp_parse(parser, http_compliant, strlen(http_compliant))) {
|
||||||
/* we may have more than just headers, so prepare for it */
|
|
||||||
if (node->stream_offset != node->offset) {
|
|
||||||
connection_read_put_back(client->con, client->refbuf->data + node->stream_offset, node->offset - node->stream_offset);
|
|
||||||
node->offset = node->stream_offset;
|
|
||||||
}
|
|
||||||
client->refbuf->len = 0;
|
client->refbuf->len = 0;
|
||||||
client->parser = parser;
|
client->parser = parser;
|
||||||
client->protocol = ICECAST_PROTOCOL_SHOUTCAST;
|
client->protocol = ICECAST_PROTOCOL_SHOUTCAST;
|
||||||
@ -1616,11 +1614,6 @@ static void _handle_connection(void)
|
|||||||
char *uri;
|
char *uri;
|
||||||
const char *upgrade, *connection;
|
const char *upgrade, *connection;
|
||||||
|
|
||||||
/* we may have more than just headers, so prepare for it */
|
|
||||||
if (node->stream_offset != node->offset) {
|
|
||||||
connection_read_put_back(client->con, client->refbuf->data + node->stream_offset, node->offset - node->stream_offset);
|
|
||||||
node->offset = node->stream_offset;
|
|
||||||
}
|
|
||||||
client->refbuf->len = 0;
|
client->refbuf->len = 0;
|
||||||
|
|
||||||
/* early check if we need more data */
|
/* early check if we need more data */
|
||||||
|
@ -1318,7 +1318,6 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1329,9 +1328,9 @@ void source_client_callback (client_t *client, void *arg)
|
|||||||
source_free_source (source);
|
source_free_source (source);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client->refbuf = old_data->associated;
|
|
||||||
old_data->associated = NULL;
|
client->refbuf->len = 0;
|
||||||
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