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

send 100-continue-header if client requests it

svn path=/icecast/trunk/icecast/; revision=19053
This commit is contained in:
Philipp Schafft 2014-01-12 12:29:27 +00:00
parent c88f7d7de2
commit c9b6d627ab
4 changed files with 24 additions and 0 deletions

View File

@ -38,6 +38,7 @@ AC_CHECK_HEADERS([pwd.h unistd.h grp.h sys/types.h],,,AC_INCLUDES_DEFAULT)
AC_CHECK_FUNCS([setuid])
AC_CHECK_FUNCS([chroot])
AC_CHECK_FUNCS([chown])
AC_CHECK_FUNCS([strcasestr])
dnl Checks for typedefs, structures, and compiler characteristics.
XIPH_C__FUNC__

View File

@ -202,6 +202,12 @@ static void client_send_error(client_t *client, int status, int plain, const cha
fserve_add_client (client, NULL);
}
void client_send_100(client_t *client)
{
/* On demand inject a HTTP/1.1 100 Continue to make sure clients are happy */
sock_write (client->con->sock, "HTTP/1.1 100 Continue\r\n\r\n");
}
void client_send_400(client_t *client, const char *message)
{
client_send_error(client, 400, 0, message);

View File

@ -70,6 +70,7 @@ typedef struct _client_tag
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
void client_destroy(client_t *client);
void client_send_100(client_t *client);
void client_send_404(client_t *client, const char *message);
void client_send_401(client_t *client);
void client_send_403(client_t *client, const char *message);

View File

@ -804,6 +804,7 @@ int connection_complete_source (source_t *source, int response)
if (global.sources < config->source_limit)
{
const char *contenttype;
const char *expectcontinue;
mount_proxy *mountinfo;
format_type_t format_type;
@ -846,6 +847,21 @@ 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)
{
#ifdef HAVE_STRCASESTR
if (strcasestr (expectcontinue, "100-continue") != NULL)
#else
WARN0("OS doesn't support case insenestive substring checks...");
if (strstr (expectcontinue, "100-continue") != NULL)
#endif
{
client_send_100 (source->client);
}
}
global.sources++;
stats_event_args (NULL, "sources", "%d", global.sources);
global_unlock();