diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -584,21 +584,41 @@ PUT: { if (encoding == SOUP_ENCODING_CONTENT_LENGTH) g_timeout_add_seconds (2, (GSourceFunc)increment_read_timer, ctx); goto out; - } + } GET: { - if (!g_hash_table_contains (ctx_table, soup_uri_get_path (uri))) { + const char *query; + TranscodeServerCtx *server_ctx; + + if (!g_hash_table_contains (ctx_table, + soup_uri_get_path (uri))) { g_print ("No stream on URI: %s\n", soup_uri_get_path (uri)); soup_message_set_status (msg, SOUP_STATUS_NOT_FOUND); goto out; } + query = soup_uri_get_query (uri); + if (query && g_strcmp0 (query, "abort") == 0) { + /* We just use the "uri" field for this, so this is OK */ + server_ctx = get_server_ctx_from_msg (msg, ctx_table); + /* Abort all processing for this stream */ + if (!server_ctx->stream_finished) { + /* Close the PUT stream if necessary */ + server_ctx->stream_finished = TRUE; + soup_message_set_status (server_ctx->msg, SOUP_STATUS_OK); + } + /* Disconnect all clients, and shut down the stream */ + stp_cleanup_transcode_server_ctx (server_ctx); + soup_message_set_status (msg, SOUP_STATUS_OK); + goto out; + } + /* Our response will be chunked, and not with a fixed Content-Length */ soup_message_headers_set_encoding (msg->response_headers, SOUP_ENCODING_CHUNKED); /* The request body isn't fixed length, so tell libsoup to * not collect chunks for forming a complete request body */ soup_message_body_set_accumulate (msg->response_body, FALSE); - } + } out: soup_uri_free (uri); |