Commit c9b6d627 authored by Philipp Schafft's avatar Philipp Schafft 🦁

send 100-continue-header if client requests it

svn path=/icecast/trunk/icecast/; revision=19053
parent c88f7d7d
......@@ -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__
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment