From 5e2f6cd04b28505e2fc906308f487bd4067a6935 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 31 Jul 2014 15:03:47 +0530 Subject: main: Add some debug messages for HTTP error statuses --- src/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.c b/src/main.c index 6ef0d37..fc43552 100644 --- a/src/main.c +++ b/src/main.c @@ -92,6 +92,7 @@ stp_validate_fetch_token_from_query (GHashTable *tokens, STPStreamToken *token, *perms_token; if (!query_string) { + g_debug ("Rejecting stream: no query string specified"); *http_status_code = SOUP_STATUS_BAD_REQUEST; return NULL; } @@ -100,6 +101,7 @@ stp_validate_fetch_token_from_query (GHashTable *tokens, if (stp_inet_addrmask && !g_hash_table_contains (tokens, sessionid)) { + g_debug ("Rejecting stream: unauthorized session id"); *http_status_code = SOUP_STATUS_FORBIDDEN; return NULL; } @@ -114,6 +116,7 @@ stp_validate_fetch_token_from_query (GHashTable *tokens, perms_token = g_hash_table_lookup (tokens, sessionid); if (stp_inet_addrmask && perms_token && perms_token->stream_type != token->stream_type) { + g_debug ("Rejecting stream: Stream type does not match"); *http_status_code = SOUP_STATUS_FORBIDDEN; goto err; } @@ -126,6 +129,7 @@ stp_validate_fetch_token_from_query (GHashTable *tokens, token->udp_clients = g_strdup (udp_clients); if (!token->udp_clients) { + g_debug ("Rejecting stream: Stream type is UDP but no UDP clients specified"); *http_status_code = SOUP_STATUS_BAD_REQUEST; goto err; } @@ -133,6 +137,7 @@ stp_validate_fetch_token_from_query (GHashTable *tokens, if (perms_token && !stp_clients_is_subset (perms_token->udp_clients, token->udp_clients)) { + g_debug ("Rejecting stream: UDP client list does not match"); *http_status_code = SOUP_STATUS_FORBIDDEN; goto err; } @@ -830,6 +835,7 @@ POST: { const char *type, *sessionid, *udp_clients; if (!stp_validate_token_server (stp_inet_addrmask, client)) { + g_debug ("Attempted to access token API from unauthorized host"); soup_message_set_status (msg, SOUP_STATUS_FORBIDDEN); goto out; } @@ -895,6 +901,7 @@ DELETE: { char *sessionid; if (!stp_validate_token_server (stp_inet_addrmask, client)) { + g_debug ("Attempted to access token API from unauthorized host"); soup_message_set_status (msg, SOUP_STATUS_FORBIDDEN); goto out; } @@ -959,6 +966,7 @@ GET: { const char *tmp; if (!stp_validate_token_server (stp_inet_addrmask, client)) { + g_debug ("Attempted to access token API from unauthorized host"); soup_message_set_status (msg, SOUP_STATUS_FORBIDDEN); goto out; } @@ -1039,6 +1047,7 @@ GET: { char *sessionid, *response; if (!stp_validate_token_server (stp_inet_addrmask, client)) { + g_debug ("Attempted to access token API from unauthorized host"); soup_message_set_status (msg, SOUP_STATUS_FORBIDDEN); goto out; } @@ -1116,6 +1125,7 @@ DELETE: { STPServerCtx *ctx; if (!stp_validate_token_server (stp_inet_addrmask, client)) { + g_debug ("Attempted to access token API from unauthorized host"); soup_message_set_status (msg, SOUP_STATUS_FORBIDDEN); goto out; } -- cgit v0.11.2-2-gd1dd