summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2014-07-31 09:33:47 (GMT)
committerNirbheek Chauhan <nirbheek@centricular.com>2014-07-31 09:37:04 (GMT)
commit5e2f6cd04b28505e2fc906308f487bd4067a6935 (patch)
treef1ace5cbf69f6afa4a25382de1f398a06648b3ca /src
parent12705920452bc2106be03e582bb9f6502f61944f (diff)
downloadsoup-transcoding-proxy-5e2f6cd04b28505e2fc906308f487bd4067a6935.zip
soup-transcoding-proxy-5e2f6cd04b28505e2fc906308f487bd4067a6935.tar.gz
main: Add some debug messages for HTTP error statuses
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
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;
}