js: Move /save to C.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 15m51s

This commit is contained in:
2024-10-27 13:42:56 -04:00
parent 01b8c209de
commit 863e50203e
6 changed files with 373 additions and 173 deletions

View File

@ -407,6 +407,11 @@ static void _http_add_body_bytes(tf_http_connection_t* connection, const void* d
if (connection->body_length == connection->content_length)
{
/* Null-terminate for convenience. */
if (connection->body)
{
((char*)connection->body)[connection->body_length] = '\0';
}
tf_http_request_t* request = tf_malloc(sizeof(tf_http_request_t));
*request = (tf_http_request_t) {
.http = connection->http,
@ -500,7 +505,7 @@ static size_t _http_on_read_plain_internal(tf_http_connection_t* connection, con
if (connection->content_length)
{
connection->body = tf_realloc(connection->body, connection->content_length);
connection->body = tf_realloc(connection->body, connection->content_length + 1);
}
if (!_http_find_handler(connection->http, connection->path, &connection->callback, &connection->trace_name, &connection->user_data) || !connection->callback)