mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Cleanup: converted tabs into spaces
This commit is contained in:
parent
99d9be1dc5
commit
e9a90f9918
24
src/admin.c
24
src/admin.c
@ -298,10 +298,10 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
|
||||
client_set_queue(client, NULL);
|
||||
client->refbuf = refbuf_new(buf_len);
|
||||
|
||||
ret = util_http_build_header(client->refbuf->data, buf_len, 0,
|
||||
0, 200, NULL,
|
||||
"text/xml", "utf-8",
|
||||
NULL, NULL);
|
||||
ret = util_http_build_header(client->refbuf->data, buf_len, 0,
|
||||
0, 200, NULL,
|
||||
"text/xml", "utf-8",
|
||||
NULL, NULL);
|
||||
if (ret < 0) {
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
client_send_error(client, 500, 0, "Header generation failed.");
|
||||
@ -334,7 +334,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
|
||||
}
|
||||
|
||||
/* FIXME: in this section we hope no function will ever return -1 */
|
||||
ret += snprintf (client->refbuf->data + ret, buf_len - ret, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff);
|
||||
ret += snprintf (client->refbuf->data + ret, buf_len - ret, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff);
|
||||
|
||||
client->refbuf->len = ret;
|
||||
xmlFree(buff);
|
||||
@ -575,8 +575,8 @@ static void html_success(client_t *client, char *message)
|
||||
|
||||
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
|
||||
0, 200, NULL,
|
||||
"text/html", "utf-8",
|
||||
"", NULL);
|
||||
"text/html", "utf-8",
|
||||
"", NULL);
|
||||
|
||||
if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) {
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
@ -748,8 +748,8 @@ static void command_buildm3u(client_t *client, const char *mount)
|
||||
|
||||
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
|
||||
0, 200, NULL,
|
||||
"audio/x-mpegurl", NULL,
|
||||
NULL, NULL);
|
||||
"audio/x-mpegurl", NULL,
|
||||
NULL, NULL);
|
||||
|
||||
if (ret == -1 || ret >= (PER_CLIENT_REFBUF_SIZE - 512)) { /* we want at least 512 Byte left for data */
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
@ -1155,9 +1155,9 @@ static void command_list_mounts(client_t *client, int response)
|
||||
if (response == PLAINTEXT)
|
||||
{
|
||||
ssize_t ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
|
||||
0, 200, NULL,
|
||||
"text/plain", "utf-8",
|
||||
"", NULL);
|
||||
0, 200, NULL,
|
||||
"text/plain", "utf-8",
|
||||
"", NULL);
|
||||
|
||||
if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) {
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
|
@ -334,12 +334,12 @@ static auth_result url_add_client (auth_client *auth_user)
|
||||
cur_header = pass_headers;
|
||||
while (cur_header)
|
||||
{
|
||||
next_header = strstr (cur_header, ",");
|
||||
if (next_header)
|
||||
{
|
||||
*next_header=0;
|
||||
next_header = strstr (cur_header, ",");
|
||||
if (next_header)
|
||||
{
|
||||
*next_header=0;
|
||||
next_header++;
|
||||
}
|
||||
}
|
||||
|
||||
header_val = httpp_getvar (client->parser, cur_header);
|
||||
if (header_val)
|
||||
@ -351,7 +351,7 @@ static auth_result url_add_client (auth_client *auth_user)
|
||||
free (header_valesc);
|
||||
}
|
||||
|
||||
cur_header = next_header;
|
||||
cur_header = next_header;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1080,17 +1080,17 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
tmp = (char *)xmlGetProp(node, XMLSTR("type"));
|
||||
if (tmp) {
|
||||
if (strcmp(tmp, "normal") == 0) {
|
||||
mount->mounttype = MOUNT_TYPE_NORMAL;
|
||||
}
|
||||
else if (strcmp(tmp, "default") == 0) {
|
||||
mount->mounttype = MOUNT_TYPE_DEFAULT;
|
||||
}
|
||||
else {
|
||||
ICECAST_LOG_WARN("Unknown mountpoint type: %s", tmp);
|
||||
mount->mounttype = MOUNT_TYPE_NORMAL;
|
||||
}
|
||||
else if (strcmp(tmp, "default") == 0) {
|
||||
mount->mounttype = MOUNT_TYPE_DEFAULT;
|
||||
}
|
||||
else {
|
||||
ICECAST_LOG_WARN("Unknown mountpoint type: %s", tmp);
|
||||
config_clear_mount (mount);
|
||||
return;
|
||||
}
|
||||
xmlFree(tmp);
|
||||
}
|
||||
xmlFree(tmp);
|
||||
}
|
||||
|
||||
node = node->xmlChildrenNode;
|
||||
@ -1281,7 +1281,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
}
|
||||
else if (mount->mountname != NULL && mount->mounttype == MOUNT_TYPE_DEFAULT)
|
||||
{
|
||||
ICECAST_LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname);
|
||||
ICECAST_LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname);
|
||||
}
|
||||
|
||||
while (authstack) {
|
||||
@ -1364,9 +1364,9 @@ static void _parse_http_headers(xmlDocPtr doc, xmlNodePtr node, ice_config_http_
|
||||
} while ((node = node->next));
|
||||
/* in case we used break we may need to clean those up */
|
||||
if (name)
|
||||
xmlFree(name);
|
||||
xmlFree(name);
|
||||
if (value)
|
||||
xmlFree(value);
|
||||
xmlFree(value);
|
||||
}
|
||||
|
||||
static void _parse_relay(xmlDocPtr doc, xmlNodePtr node,
|
||||
@ -1920,54 +1920,54 @@ static void merge_mounts(mount_proxy * dst, mount_proxy * src) {
|
||||
ice_config_http_header_t **http_header_tail;
|
||||
|
||||
if (!dst || !src)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!dst->dumpfile)
|
||||
dst->dumpfile = (char*)xmlStrdup((xmlChar*)src->dumpfile);
|
||||
dst->dumpfile = (char*)xmlStrdup((xmlChar*)src->dumpfile);
|
||||
if (!dst->intro_filename)
|
||||
dst->intro_filename = (char*)xmlStrdup((xmlChar*)src->intro_filename);
|
||||
dst->intro_filename = (char*)xmlStrdup((xmlChar*)src->intro_filename);
|
||||
if (!dst->fallback_when_full)
|
||||
dst->fallback_when_full = src->fallback_when_full;
|
||||
dst->fallback_when_full = src->fallback_when_full;
|
||||
if (dst->max_listeners == -1)
|
||||
dst->max_listeners = src->max_listeners;
|
||||
dst->max_listeners = src->max_listeners;
|
||||
if (!dst->fallback_mount)
|
||||
dst->fallback_mount = (char*)xmlStrdup((xmlChar*)src->fallback_mount);
|
||||
dst->fallback_mount = (char*)xmlStrdup((xmlChar*)src->fallback_mount);
|
||||
if (!dst->fallback_override)
|
||||
dst->fallback_override = src->fallback_override;
|
||||
dst->fallback_override = src->fallback_override;
|
||||
if (!dst->no_mount)
|
||||
dst->no_mount = src->no_mount;
|
||||
dst->no_mount = src->no_mount;
|
||||
if (dst->burst_size == -1)
|
||||
dst->burst_size = src->burst_size;
|
||||
dst->burst_size = src->burst_size;
|
||||
if (!dst->queue_size_limit)
|
||||
dst->queue_size_limit = src->queue_size_limit;
|
||||
dst->queue_size_limit = src->queue_size_limit;
|
||||
if (!dst->hidden)
|
||||
dst->hidden = src->hidden;
|
||||
dst->hidden = src->hidden;
|
||||
if (!dst->source_timeout)
|
||||
dst->source_timeout = src->source_timeout;
|
||||
dst->source_timeout = src->source_timeout;
|
||||
if (!dst->charset)
|
||||
dst->charset = (char*)xmlStrdup((xmlChar*)src->charset);
|
||||
dst->charset = (char*)xmlStrdup((xmlChar*)src->charset);
|
||||
if (dst->mp3_meta_interval == -1)
|
||||
dst->mp3_meta_interval = src->mp3_meta_interval;
|
||||
dst->mp3_meta_interval = src->mp3_meta_interval;
|
||||
if (!dst->cluster_password)
|
||||
dst->cluster_password = (char*)xmlStrdup((xmlChar*)src->cluster_password);
|
||||
dst->cluster_password = (char*)xmlStrdup((xmlChar*)src->cluster_password);
|
||||
if (!dst->max_listener_duration)
|
||||
dst->max_listener_duration = src->max_listener_duration;
|
||||
dst->max_listener_duration = src->max_listener_duration;
|
||||
if (!dst->stream_name)
|
||||
dst->stream_name = (char*)xmlStrdup((xmlChar*)src->stream_name);
|
||||
dst->stream_name = (char*)xmlStrdup((xmlChar*)src->stream_name);
|
||||
if (!dst->stream_description)
|
||||
dst->stream_description = (char*)xmlStrdup((xmlChar*)src->stream_description);
|
||||
dst->stream_description = (char*)xmlStrdup((xmlChar*)src->stream_description);
|
||||
if (!dst->stream_url)
|
||||
dst->stream_url = (char*)xmlStrdup((xmlChar*)src->stream_url);
|
||||
dst->stream_url = (char*)xmlStrdup((xmlChar*)src->stream_url);
|
||||
if (!dst->stream_genre)
|
||||
dst->stream_genre = (char*)xmlStrdup((xmlChar*)src->stream_genre);
|
||||
dst->stream_genre = (char*)xmlStrdup((xmlChar*)src->stream_genre);
|
||||
if (!dst->bitrate)
|
||||
dst->bitrate = (char*)xmlStrdup((xmlChar*)src->bitrate);
|
||||
dst->bitrate = (char*)xmlStrdup((xmlChar*)src->bitrate);
|
||||
if (!dst->type)
|
||||
dst->type = (char*)xmlStrdup((xmlChar*)src->type);
|
||||
dst->type = (char*)xmlStrdup((xmlChar*)src->type);
|
||||
if (!dst->subtype)
|
||||
dst->subtype = (char*)xmlStrdup((xmlChar*)src->subtype);
|
||||
dst->subtype = (char*)xmlStrdup((xmlChar*)src->subtype);
|
||||
if (dst->yp_public == -1)
|
||||
dst->yp_public = src->yp_public;
|
||||
dst->yp_public = src->yp_public;
|
||||
|
||||
if (dst->http_headers) {
|
||||
http_header_next = dst->http_headers;
|
||||
@ -1985,12 +1985,12 @@ static inline void _merge_mounts_all(ice_config_t *c) {
|
||||
|
||||
for (; mountinfo; mountinfo = mountinfo->next)
|
||||
{
|
||||
if (mountinfo->mounttype != MOUNT_TYPE_NORMAL)
|
||||
continue;
|
||||
if (mountinfo->mounttype != MOUNT_TYPE_NORMAL)
|
||||
continue;
|
||||
|
||||
default_mount = config_find_mount(c, mountinfo->mountname, MOUNT_TYPE_DEFAULT);
|
||||
|
||||
merge_mounts(mountinfo, default_mount);
|
||||
merge_mounts(mountinfo, default_mount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2001,16 +2001,16 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t
|
||||
for (; mountinfo; mountinfo = mountinfo->next)
|
||||
{
|
||||
if (mountinfo->mounttype != type)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (!mount && !mountinfo->mountname)
|
||||
if (!mount && !mountinfo->mountname)
|
||||
break;
|
||||
|
||||
if (mountinfo->mounttype == MOUNT_TYPE_NORMAL) {
|
||||
if (!mount || !mountinfo->mountname)
|
||||
continue;
|
||||
|
||||
if (strcmp(mountinfo->mountname, mount) == 0)
|
||||
if (strcmp(mountinfo->mountname, mount) == 0)
|
||||
break;
|
||||
} else if (mountinfo->mounttype == MOUNT_TYPE_DEFAULT) {
|
||||
if (!mountinfo->mountname)
|
||||
|
@ -852,20 +852,20 @@ int connection_complete_source (source_t *source, int response)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For PUT support we check for 100-continue and send back a 100 to stay in spec */
|
||||
expectcontinue = httpp_getvar (source->parser, "expect");
|
||||
if (expectcontinue != NULL)
|
||||
{
|
||||
/* For PUT support we check for 100-continue and send back a 100 to stay in spec */
|
||||
expectcontinue = httpp_getvar (source->parser, "expect");
|
||||
if (expectcontinue != NULL)
|
||||
{
|
||||
#ifdef HAVE_STRCASESTR
|
||||
if (strcasestr (expectcontinue, "100-continue") != NULL)
|
||||
if (strcasestr (expectcontinue, "100-continue") != NULL)
|
||||
#else
|
||||
ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks...");
|
||||
if (strstr (expectcontinue, "100-continue") != NULL)
|
||||
ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks...");
|
||||
if (strstr (expectcontinue, "100-continue") != NULL)
|
||||
#endif
|
||||
{
|
||||
client_send_100 (source->client);
|
||||
}
|
||||
}
|
||||
{
|
||||
client_send_100 (source->client);
|
||||
}
|
||||
}
|
||||
|
||||
global.sources++;
|
||||
stats_event_args (NULL, "sources", "%d", global.sources);
|
||||
|
24
src/format.c
24
src/format.c
@ -73,8 +73,8 @@ format_type_t format_get_type (const char *contenttype)
|
||||
else
|
||||
/* We default to the Generic format handler, which
|
||||
can handle many more formats than just mp3.
|
||||
Let's warn that this is not well supported */
|
||||
ICECAST_LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype);
|
||||
Let's warn that this is not well supported */
|
||||
ICECAST_LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype);
|
||||
return FORMAT_TYPE_GENERIC;
|
||||
}
|
||||
|
||||
@ -352,21 +352,21 @@ static int format_prepare_headers (source_t *source, client_t *client)
|
||||
if (strcasecmp(var->name, "ice-password") &&
|
||||
strcasecmp(var->name, "icy-metaint"))
|
||||
{
|
||||
if (!strcasecmp(var->name, "ice-name"))
|
||||
{
|
||||
ice_config_t *config;
|
||||
mount_proxy *mountinfo;
|
||||
if (!strcasecmp(var->name, "ice-name"))
|
||||
{
|
||||
ice_config_t *config;
|
||||
mount_proxy *mountinfo;
|
||||
|
||||
config = config_get_config();
|
||||
mountinfo = config_find_mount (config, source->mount, MOUNT_TYPE_NORMAL);
|
||||
config = config_get_config();
|
||||
mountinfo = config_find_mount (config, source->mount, MOUNT_TYPE_NORMAL);
|
||||
|
||||
if (mountinfo && mountinfo->stream_name)
|
||||
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", mountinfo->stream_name);
|
||||
if (mountinfo && mountinfo->stream_name)
|
||||
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", mountinfo->stream_name);
|
||||
else
|
||||
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", var->value);
|
||||
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", var->value);
|
||||
|
||||
config_release_config();
|
||||
}
|
||||
}
|
||||
else if (!strncasecmp("ice-", var->name, 4))
|
||||
{
|
||||
if (!strcasecmp("ice-public", var->name))
|
||||
|
@ -613,7 +613,7 @@ static refbuf_t *mp3_get_filter_meta(source_t *source)
|
||||
memcpy (meta->data, source_mp3->build_metadata,
|
||||
source_mp3->build_metadata_len);
|
||||
|
||||
ICECAST_LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1);
|
||||
ICECAST_LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1);
|
||||
if (strncmp (meta->data+1, "StreamTitle=", 12) == 0)
|
||||
{
|
||||
filter_shoutcast_metadata (source, source_mp3->build_metadata,
|
||||
|
24
src/fserve.c
24
src/fserve.c
@ -461,8 +461,8 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
*dot = 0;
|
||||
httpclient->respcode = 200;
|
||||
ret = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
|
||||
0, 200, NULL,
|
||||
"audio/x-mpegurl", NULL, "", NULL);
|
||||
0, 200, NULL,
|
||||
"audio/x-mpegurl", NULL, "", NULL);
|
||||
if (ret == -1 || ret >= (BUFSIZE - 512)) { /* we want at least 512 bytes left for the content of the playlist */
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
client_send_error(httpclient, 500, 0, "Header generation failed.");
|
||||
@ -470,7 +470,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
}
|
||||
if (host == NULL)
|
||||
{
|
||||
config = config_get_config();
|
||||
config = config_get_config();
|
||||
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
|
||||
"http://%s:%d%s\r\n",
|
||||
config->hostname, config->port,
|
||||
@ -480,7 +480,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
|
||||
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
|
||||
"http://%s%s\r\n",
|
||||
host,
|
||||
sourceuri
|
||||
@ -573,10 +573,10 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
}
|
||||
httpclient->respcode = 206;
|
||||
type = fserve_content_type (path);
|
||||
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
|
||||
0, 206, NULL,
|
||||
type, NULL,
|
||||
NULL, NULL);
|
||||
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
|
||||
0, 206, NULL,
|
||||
type, NULL,
|
||||
NULL, NULL);
|
||||
if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
client_send_error(httpclient, 500, 0, "Header generation failed.");
|
||||
@ -604,10 +604,10 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
else {
|
||||
char *type = fserve_content_type(path);
|
||||
httpclient->respcode = 200;
|
||||
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
|
||||
0, 200, NULL,
|
||||
type, NULL,
|
||||
NULL, NULL);
|
||||
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
|
||||
0, 200, NULL,
|
||||
type, NULL,
|
||||
NULL, NULL);
|
||||
if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */
|
||||
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
|
||||
client_send_error(httpclient, 500, 0, "Header generation failed.");
|
||||
|
@ -427,7 +427,7 @@ static void _ch_root_uid_setup(void)
|
||||
}
|
||||
if(!initgroups(conf->user, gid))
|
||||
fprintf(stdout, "Changed supplementary groups based on user: %s.\n", conf->user);
|
||||
else
|
||||
else
|
||||
fprintf(stdout, "Error changing supplementary groups: %s.\n", strerror(errno));
|
||||
#ifdef HAVE_SETRESUID
|
||||
if(!setresuid(uid, uid, uid)) {
|
||||
|
82
src/md5.c
82
src/md5.c
@ -52,13 +52,13 @@ static void byteReverse(unsigned char *buf, unsigned longs)
|
||||
{
|
||||
uint32_t t;
|
||||
do
|
||||
{
|
||||
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32_t *) buf = t;
|
||||
buf += 4;
|
||||
{
|
||||
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32_t *) buf = t;
|
||||
buf += 4;
|
||||
}
|
||||
while (--longs);
|
||||
while (--longs);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -89,40 +89,40 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf,
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
|
||||
ctx->bits[1]++;
|
||||
ctx->bits[1]++;
|
||||
|
||||
/* Carry from low to high */
|
||||
/* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f;
|
||||
/* Bytes already in shsInfo->data */
|
||||
/* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
if (t)
|
||||
{
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
t = 64 - t;
|
||||
if (len < t)
|
||||
{
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
{
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
t = 64 - t;
|
||||
if (len < t)
|
||||
{
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64)
|
||||
{
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
{
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
@ -142,7 +142,7 @@ void MD5Final(unsigned char digest[HASH_LEN], struct MD5Context *ctx)
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
always at least one byte free */
|
||||
p = ctx->in + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
@ -151,19 +151,19 @@ void MD5Final(unsigned char digest[HASH_LEN], struct MD5Context *ctx)
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8)
|
||||
{
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
{
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, HASH_LEN);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
else
|
||||
{
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
@ -175,7 +175,7 @@ void MD5Final(unsigned char digest[HASH_LEN], struct MD5Context *ctx)
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, HASH_LEN);
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
/* In case it's sensitive */
|
||||
/* In case it's sensitive */
|
||||
}
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
@ -75,7 +75,7 @@ static void refbuf_release_associated (refbuf_t *ref)
|
||||
refbuf_t *to_go = ref;
|
||||
ref = to_go->next;
|
||||
if ( to_go->_count == 1 )
|
||||
to_go->next = NULL;
|
||||
to_go->next = NULL;
|
||||
refbuf_release (to_go);
|
||||
}
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ void source_recheck_mounts (int update_all)
|
||||
for (; mount; mount = mount->next)
|
||||
{
|
||||
if (mount->mounttype != MOUNT_TYPE_NORMAL)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
source_t *source = source_find_mount (mount->mountname);
|
||||
|
||||
|
42
src/util.c
42
src/util.c
@ -648,28 +648,28 @@ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
|
||||
else
|
||||
{
|
||||
if (!statusmsg)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 200: statusmsg = "OK"; break;
|
||||
case 206: statusmsg = "Partial Content"; http_version = "1.1"; break;
|
||||
case 400: statusmsg = "Bad Request"; break;
|
||||
case 401: statusmsg = "Authentication Required"; break;
|
||||
case 403: statusmsg = "Forbidden"; break;
|
||||
case 404: statusmsg = "File Not Found"; break;
|
||||
case 416: statusmsg = "Request Range Not Satisfiable"; break;
|
||||
default: statusmsg = "(unknown status code)"; break;
|
||||
}
|
||||
}
|
||||
snprintf (status_buffer, sizeof (status_buffer), "HTTP/%s %d %s\r\n", http_version, status, statusmsg);
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 200: statusmsg = "OK"; break;
|
||||
case 206: statusmsg = "Partial Content"; http_version = "1.1"; break;
|
||||
case 400: statusmsg = "Bad Request"; break;
|
||||
case 401: statusmsg = "Authentication Required"; break;
|
||||
case 403: statusmsg = "Forbidden"; break;
|
||||
case 404: statusmsg = "File Not Found"; break;
|
||||
case 416: statusmsg = "Request Range Not Satisfiable"; break;
|
||||
default: statusmsg = "(unknown status code)"; break;
|
||||
}
|
||||
}
|
||||
snprintf (status_buffer, sizeof (status_buffer), "HTTP/%s %d %s\r\n", http_version, status, statusmsg);
|
||||
}
|
||||
|
||||
if (contenttype)
|
||||
{
|
||||
if (charset)
|
||||
if (charset)
|
||||
snprintf (contenttype_buffer, sizeof (contenttype_buffer), "Content-Type: %s; charset=%s\r\n",
|
||||
contenttype, charset);
|
||||
else
|
||||
contenttype, charset);
|
||||
else
|
||||
snprintf (contenttype_buffer, sizeof (contenttype_buffer), "Content-Type: %s\r\n",
|
||||
contenttype);
|
||||
}
|
||||
@ -697,10 +697,10 @@ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
|
||||
extra_headers = _build_headers(status, config, source);
|
||||
ret = snprintf (out, len, "%sServer: %s\r\n%s%s%s%s%s%s%s",
|
||||
status_buffer,
|
||||
config->server_id,
|
||||
currenttime_buffer,
|
||||
contenttype_buffer,
|
||||
(status == 401 ? "WWW-Authenticate: Basic realm=\"Icecast2 Server\"\r\n" : ""),
|
||||
config->server_id,
|
||||
currenttime_buffer,
|
||||
contenttype_buffer,
|
||||
(status == 401 ? "WWW-Authenticate: Basic realm=\"Icecast2 Server\"\r\n" : ""),
|
||||
(cache ? "" : "Cache-Control: no-cache\r\n"
|
||||
"Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n"
|
||||
"Pragma: no-cache\r\n"),
|
||||
|
Loading…
Reference in New Issue
Block a user