X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=http%2Fcanned_responses.c;h=3537907bc6b94d67b723a463d03f1c07a9daee25;hb=e3f8f23d96899146464a0b3ced1eb0833bcd634f;hp=5461b46b8b2d8ecdc133c996ad9aa8e217877072;hpb=3d27274b36b44816c736ea8a411341b5a36556f9;p=blerg.git diff --git a/http/canned_responses.c b/http/canned_responses.c index 5461b46..3537907 100644 --- a/http/canned_responses.c +++ b/http/canned_responses.c @@ -1,10 +1,14 @@ +/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a + * BSD-style license. Please see the COPYING file for details. + */ #include #include #include "app.h" #include "canned_responses.h" void init_responses() { - response_401 = MHD_create_response_from_data(strlen (CONTENT_401), CONTENT_401, MHD_NO, MHD_NO); + response_401 = MHD_create_response_from_data(strlen(CONTENT_401), CONTENT_401, MHD_NO, MHD_NO); + response_403 = MHD_create_response_from_data(strlen(CONTENT_403), CONTENT_403, MHD_NO, MHD_NO); response_404 = MHD_create_response_from_data(strlen(CONTENT_404), CONTENT_404, MHD_NO, MHD_NO); response_405 = MHD_create_response_from_data(strlen(CONTENT_405), CONTENT_405, MHD_NO, MHD_NO); response_JSON_Success = MHD_create_response_from_data(strlen(JSON_SUCCESS), JSON_SUCCESS, MHD_NO, MHD_NO); @@ -16,6 +20,10 @@ int respond_401(struct MHD_Connection *connection, int signal_stale) { return MHD_queue_auth_fail_response(connection, REALM, OPAQUE, response_401, signal_stale); } +int respond_403(struct MHD_Connection *connection) { + return MHD_queue_response(connection, MHD_HTTP_FORBIDDEN, response_403); +} + int respond_404(struct MHD_Connection *connection) { return MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response_404); }