aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/reason_phrase.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-12-16 10:28:22 +0000
committerChristian Grothoff <christian@grothoff.org>2007-12-16 10:28:22 +0000
commitf794d6b09631610e4473d6e356f24b09195105bf (patch)
treeb1b6b713478d0f2b52f10e921ffd16093a12c60f /src/daemon/reason_phrase.c
parentbaeae167a103b40a032e005b50ae13e49ac0ceed (diff)
downloadlibmicrohttpd-f794d6b09631610e4473d6e356f24b09195105bf.tar.gz
libmicrohttpd-f794d6b09631610e4473d6e356f24b09195105bf.zip
formatting
Diffstat (limited to 'src/daemon/reason_phrase.c')
-rw-r--r--src/daemon/reason_phrase.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/daemon/reason_phrase.c b/src/daemon/reason_phrase.c
index 403bd6cf..2dc5a826 100644
--- a/src/daemon/reason_phrase.c
+++ b/src/daemon/reason_phrase.c
@@ -28,15 +28,15 @@
28 28
29#include "reason_phrase.h" 29#include "reason_phrase.h"
30 30
31static const char * invalid_hundred[] = { }; 31static const char *invalid_hundred[] = { };
32 32
33static const char * one_hundred[] = { 33static const char *one_hundred[] = {
34 "Continue", 34 "Continue",
35 "Switching Protocols", 35 "Switching Protocols",
36 "Processing" 36 "Processing"
37}; 37};
38 38
39static const char* two_hundred[] = { 39static const char *two_hundred[] = {
40 "OK", 40 "OK",
41 "Created", 41 "Created",
42 "Accepted", 42 "Accepted",
@@ -46,7 +46,7 @@ static const char* two_hundred[] = {
46 "Partial Content" 46 "Partial Content"
47}; 47};
48 48
49static const char* three_hundred[] = { 49static const char *three_hundred[] = {
50 "Multiple Choices", 50 "Multiple Choices",
51 "Moved Permanently", 51 "Moved Permanently",
52 "Moved Temporarily", 52 "Moved Temporarily",
@@ -55,7 +55,7 @@ static const char* three_hundred[] = {
55 "Use Proxy" 55 "Use Proxy"
56}; 56};
57 57
58static const char* four_hundred[] = { 58static const char *four_hundred[] = {
59 "Bad Request", 59 "Bad Request",
60 "Unauthorized", 60 "Unauthorized",
61 "Payment Required", 61 "Payment Required",
@@ -74,7 +74,7 @@ static const char* four_hundred[] = {
74 "Unsupported Media Type" 74 "Unsupported Media Type"
75}; 75};
76 76
77static const char* five_hundred[] = { 77static const char *five_hundred[] = {
78 "Internal Server Error", 78 "Internal Server Error",
79 "Bad Gateway", 79 "Bad Gateway",
80 "Service Unavailable", 80 "Service Unavailable",
@@ -83,27 +83,27 @@ static const char* five_hundred[] = {
83}; 83};
84 84
85 85
86struct MHD_Reason_Block { 86struct MHD_Reason_Block
87{
87 unsigned int max; 88 unsigned int max;
88 const char ** data; 89 const char **data;
89}; 90};
90 91
91#define BLOCK(m) { (sizeof(m) / sizeof(char*)), m } 92#define BLOCK(m) { (sizeof(m) / sizeof(char*)), m }
92 93
93static const struct MHD_Reason_Block reasons[] = { 94static const struct MHD_Reason_Block reasons[] = {
94 BLOCK(invalid_hundred), 95 BLOCK (invalid_hundred),
95 BLOCK(one_hundred), 96 BLOCK (one_hundred),
96 BLOCK(two_hundred), 97 BLOCK (two_hundred),
97 BLOCK(three_hundred), 98 BLOCK (three_hundred),
98 BLOCK(four_hundred), 99 BLOCK (four_hundred),
99 BLOCK(five_hundred), 100 BLOCK (five_hundred),
100}; 101};
101 102
102const char * 103const char *
103MHD_get_reason_phrase_for(unsigned int code) 104MHD_get_reason_phrase_for (unsigned int code)
104{ 105{
105 if ( (code >= 100 && code < 600) && 106 if ((code >= 100 && code < 600) && (reasons[code / 100].max > code % 100))
106 (reasons[code / 100].max > code % 100) )
107 return reasons[code / 100].data[code % 100]; 107 return reasons[code / 100].data[code % 100];
108 return "Unknown"; 108 return "Unknown";
109} 109}