GNU libmicrohttpd
0.9.5
Main Page
Data Structures
Files
File List
Globals
reason_phrase.c
Go to the documentation of this file.
1
/*
2
This file is part of libmicrohttpd
3
(C) 2007, 2011 Christian Grothoff
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19
*/
20
28
#include "
reason_phrase.h
"
29
30
#ifndef NULL
31
#define NULL (void*)0
32
#endif
33
34
static
const
char
*
invalid_hundred
[] = {
NULL
};
35
36
static
const
char
*
one_hundred
[] = {
37
"Continue"
,
38
"Switching Protocols"
,
39
"Processing"
40
};
41
42
static
const
char
*
two_hundred
[] = {
43
"OK"
,
44
"Created"
,
45
"Accepted"
,
46
"Non-Authoritative Information"
,
47
"No Content"
,
48
"Reset Content"
,
49
"Partial Content"
,
50
"Multi Status"
51
};
52
53
static
const
char
*
three_hundred
[] = {
54
"Multiple Choices"
,
55
"Moved Permanently"
,
56
"Moved Temporarily"
,
57
"See Other"
,
58
"Not Modified"
,
59
"Use Proxy"
,
60
"Switch Proxy"
,
61
"Temporary Redirect"
62
};
63
64
static
const
char
*
four_hundred
[] = {
65
"Bad Request"
,
66
"Unauthorized"
,
67
"Payment Required"
,
68
"Forbidden"
,
69
"Not Found"
,
70
"Method Not Allowed"
,
71
"Not Acceptable"
,
72
"Proxy Authentication Required"
,
73
"Request Time-out"
,
74
"Conflict"
,
75
"Gone"
,
76
"Length Required"
,
77
"Precondition Failed"
,
78
"Request Entity Too Large"
,
79
"Request-URI Too Large"
,
80
"Unsupported Media Type"
,
81
"Requested Range Not Satisfiable"
,
82
"Expectation Failed"
,
83
"Unknown"
,
84
"Unknown"
,
85
"Unknown"
,
/* 420 */
86
"Unknown"
,
87
"Unprocessable Entity"
,
88
"Locked"
,
89
"Failed Dependency"
,
90
"Unordered Collection"
,
91
"Upgrade Required"
,
92
"Unknown"
,
93
"Unknown"
,
94
"Unknown"
,
95
"Unknown"
,
/* 430 */
96
"Unknown"
,
97
"Unknown"
,
98
"Unknown"
,
99
"Unknown"
,
100
"Unknown"
,
/* 435 */
101
"Unknown"
,
102
"Unknown"
,
103
"Unknown"
,
104
"Unknown"
,
105
"Unknown"
,
/* 440 */
106
"Unknown"
,
107
"Unknown"
,
108
"Unknown"
,
109
"No Response"
,
110
"Unknown"
,
/* 445 */
111
"Unknown"
,
112
"Unknown"
,
113
"Unknown"
,
114
"Retry With"
,
115
"Blocked by Windows Parental Controls"
,
/* 450 */
116
"Unavailable For Legal Reasons"
117
};
118
119
static
const
char
*
five_hundred
[] = {
120
"Internal Server Error"
,
121
"Not Implemented"
,
122
"Bad Gateway"
,
123
"Service Unavailable"
,
124
"Gateway Time-out"
,
125
"HTTP Version not supported"
,
126
"Variant Also Negotiates"
,
127
"Insufficient Storage"
,
128
"Unknown"
,
129
"Bandwidth Limit Exceeded"
,
130
"Not Extended"
131
};
132
133
134
struct
MHD_Reason_Block
135
{
136
unsigned
int
max;
137
const
char
**data;
138
};
139
140
#define BLOCK(m) { (sizeof(m) / sizeof(char*)), m }
141
142
static
const
struct
MHD_Reason_Block
reasons
[] = {
143
BLOCK
(
invalid_hundred
),
144
BLOCK
(
one_hundred
),
145
BLOCK
(
two_hundred
),
146
BLOCK
(
three_hundred
),
147
BLOCK
(
four_hundred
),
148
BLOCK
(
five_hundred
),
149
};
150
151
const
char
*
152
MHD_get_reason_phrase_for
(
unsigned
int
code)
153
{
154
if
( (code >= 100) &&
155
(code < 600) &&
156
(reasons[code / 100].max > (code % 100)) )
157
return
reasons[code / 100].data[code % 100];
158
return
"Unknown"
;
159
}
src
daemon
reason_phrase.c
Generated by
1.8.1.2