-add support for ICECAST-style uploads

This commit is contained in:
Christian Grothoff
2023-09-25 20:32:53 +02:00
parent 8962cba42d
commit 19e1ed8355
2 changed files with 28 additions and 4 deletions
+10 -1
View File
@@ -1503,7 +1503,16 @@ enum MHD_FLAG
* Flag set to enable TLS 1.3 early data. This has
* security implications, be VERY careful when using this.
*/
MHD_USE_INSECURE_TLS_EARLY_DATA = 1U << 18
MHD_USE_INSECURE_TLS_EARLY_DATA = 1U << 18,
/**
* Flag set to allow uploads from clients even if the client supplied no
* transfer encoding and no Content-length header. The upload is expected
* to be concluded when the client closes the connection.
* This is in violation of RFC 7230 but useful for
* Icecast. Use at your own risk.
*/
MHD_USE_ICECAST_CLIENT_UPLOADS = 1U << 19
};
+18 -3
View File
@@ -348,7 +348,7 @@
#define REQUEST_LACKS_HOST \
"<html>" \
"<head><title>&quot;Host:&quot; header required</title></head>" \
"<body>HTTP/1.1 request without <b>&quot;Host:&quot;</b>.</body>"\
"<body>HTTP/1.1 request without <b>&quot;Host:&quot;</b>.</body>" \
"</html>"
#else
@@ -457,7 +457,7 @@
#define ERROR_MSG_DATA_NOT_HANDLED_BY_APP \
"<html><head><title>Internal server error</title></head>" \
"<body>Please ask the developer of this Web server to carefully " \
"read the GNU libmicrohttpd documentation about connection "\
"read the GNU libmicrohttpd documentation about connection " \
"management and blocking.</body></html>"
#else
#define ERROR_MSG_DATA_NOT_HANDLED_BY_APP ""
@@ -4048,7 +4048,22 @@ parse_connection_headers (struct MHD_Connection *connection)
return;
}
connection->rq.remaining_upload_size = 0;
if ( ((0 == (MHD_USE_ICECAST_CLIENT_UPLOADS & connection->daemon->options)) ||
(! MHD_lookup_header_s_token_ci (connection,
MHD_HTTP_HEADER_CONNECTION,
"close")) ) )
{
/* Normal case: either no upload allowed, or client has to provide
headers as per below */
connection->rq.remaining_upload_size = 0;
}
else
{
/* Special Icecast case: client says nothing, but still uploads until
connection close. Only allowed with ICECAST option *and* if the
client at least announced that it will close the connection. */
connection->rq.remaining_upload_size = MHD_SIZE_UNKNOWN;
}
if (MHD_NO !=
MHD_lookup_connection_value_n (connection,
MHD_HEADER_KIND,