diff options
author | Christian Grothoff <christian@grothoff.org> | 2007-12-16 10:28:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2007-12-16 10:28:22 +0000 |
commit | f794d6b09631610e4473d6e356f24b09195105bf (patch) | |
tree | b1b6b713478d0f2b52f10e921ffd16093a12c60f /src/daemon/reason_phrase.c | |
parent | baeae167a103b40a032e005b50ae13e49ac0ceed (diff) | |
download | libmicrohttpd-f794d6b09631610e4473d6e356f24b09195105bf.tar.gz libmicrohttpd-f794d6b09631610e4473d6e356f24b09195105bf.zip |
formatting
Diffstat (limited to 'src/daemon/reason_phrase.c')
-rw-r--r-- | src/daemon/reason_phrase.c | 36 |
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 | ||
31 | static const char * invalid_hundred[] = { }; | 31 | static const char *invalid_hundred[] = { }; |
32 | 32 | ||
33 | static const char * one_hundred[] = { | 33 | static const char *one_hundred[] = { |
34 | "Continue", | 34 | "Continue", |
35 | "Switching Protocols", | 35 | "Switching Protocols", |
36 | "Processing" | 36 | "Processing" |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static const char* two_hundred[] = { | 39 | static 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 | ||
49 | static const char* three_hundred[] = { | 49 | static 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 | ||
58 | static const char* four_hundred[] = { | 58 | static 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 | ||
77 | static const char* five_hundred[] = { | 77 | static 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 | ||
86 | struct MHD_Reason_Block { | 86 | struct 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 | ||
93 | static const struct MHD_Reason_Block reasons[] = { | 94 | static 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 | ||
102 | const char * | 103 | const char * |
103 | MHD_get_reason_phrase_for(unsigned int code) | 104 | MHD_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 | } |