1 /* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
2 * BSD-style license. Please see the COPYING file for details.
6 #include "canned_responses.h"
9 void respond_simple_data(unsigned const char *data, int len) {
10 printf("Content-length: %d\r\n\r\n", len);
11 fwrite(data, len, 1, stdout);
15 printf("Status: 403 Forbidden\r\n");
16 printf("Content-type: text/html\r\n");
17 printf("Content-length: %d\r\n\r\n", strlen(CONTENT_403));
23 printf("Status: 404 Not Found\r\n");
24 printf("Content-type: text/html\r\n");
25 printf("Content-length: %d\r\n\r\n", strlen(CONTENT_404));
31 printf("Status: 405 Method Not Allowed\r\n");
32 printf("Content-type: text/html\r\n");
33 printf("Content-length: %d\r\n\r\n", strlen(CONTENT_405));
38 void respond_JSON_Failure() {
39 respond_simple_data(JSON_FAILURE, strlen(JSON_FAILURE));
42 void respond_JSON_Success() {
43 respond_simple_data(JSON_SUCCESS, strlen(JSON_SUCCESS));