StatusCode.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "Debug.h"
11 #include "http/StatusCode.h"
12 
13 const char *
15 {
16  switch (status) {
17 
18  // 000
19  case Http::scNone:
20  return "Init"; /* we init .status with code 0 */
21  break;
22 
23  // 100-199
24  case Http::scContinue:
25  return "Continue";
26  break;
27 
29  return "Switching Protocols";
30  break;
31 
32  case Http::scProcessing:
33  return "Processing";
34  break;
35 
36  case Http::scEarlyHints: // 103
37  return "Early Hints";
38  break;
39 
40  // 200-299
41  case Http::scOkay:
42  return "OK";
43  break;
44 
45  case Http::scCreated:
46  return "Created";
47  break;
48 
49  case Http::scAccepted:
50  return "Accepted";
51  break;
52 
54  return "Non-Authoritative Information";
55  break;
56 
57  case Http::scNoContent:
58  return "No Content";
59  break;
60 
62  return "Reset Content";
63  break;
64 
66  return "Partial Content";
67  break;
68 
70  return "Multi-Status";
71  break;
72 
74  return "Already Reported";
75  break;
76 
77  case Http::scImUsed:
78  return "IM Used";
79  break;
80 
81  // 300-399
83  return "Multiple Choices";
84  break;
85 
87  return "Moved Permanently";
88  break;
89 
90  case Http::scFound:
91  return "Found";
92  break;
93 
94  case Http::scSeeOther:
95  return "See Other";
96  break;
97 
99  return "Not Modified";
100  break;
101 
102  case Http::scUseProxy:
103  return "Use Proxy";
104  break;
105 
107  return "Temporary Redirect";
108  break;
109 
111  return "Permanent Redirect";
112  break;
113 
114  // 400-499
115  case Http::scBadRequest:
116  return "Bad Request";
117  break;
118 
120  return "Unauthorized";
121  break;
122 
124  return "Payment Required";
125  break;
126 
127  case Http::scForbidden:
128  return "Forbidden";
129  break;
130 
131  case Http::scNotFound:
132  return "Not Found";
133  break;
134 
136  return "Method Not Allowed";
137  break;
138 
140  return "Not Acceptable";
141  break;
142 
144  return "Proxy Authentication Required";
145  break;
146 
148  return "Request Timeout";
149  break;
150 
151  case Http::scConflict:
152  return "Conflict";
153  break;
154 
155  case Http::scGone:
156  return "Gone";
157  break;
158 
160  return "Length Required";
161  break;
162 
164  return "Precondition Failed";
165  break;
166 
168  return "Payload Too Large";
169  break;
170 
171  case Http::scUriTooLong:
172  return "URI Too Long";
173  break;
174 
176  return "Unsupported Media Type";
177  break;
178 
180  return "Requested Range Not Satisfiable";
181  break;
182 
184  return "Expectation Failed";
185  break;
186 
188  return "Misdirected Request";
189  break;
190 
192  return "Unprocessable Entity";
193  break;
194 
195  case Http::scLocked:
196  return "Locked";
197  break;
198 
200  return "Failed Dependency";
201  break;
202 
204  return "Upgrade Required";
205  break;
206 
208  return "Precondition Required";
209  break;
210 
212  return "Too Many Requests";
213  break;
214 
216  return "Request Header Fields Too Large";
217  break;
218 
220  return "Unavailable For Legal Reasons";
221  break;
222 
223  // 500-599
225  return "Internal Server Error";
226  break;
227 
229  return "Not Implemented";
230  break;
231 
232  case Http::scBadGateway:
233  return "Bad Gateway";
234  break;
235 
237  return "Service Unavailable";
238  break;
239 
241  return "Gateway Timeout";
242  break;
243 
245  return "HTTP Version not supported";
246  break;
247 
249  return "Variant Also Negotiates";
250  break;
251 
253  return "Insufficient Storage";
254  break;
255 
257  return "Loop Detected";
258  break;
259 
260  case Http::scNotExtended:
261  return "Not Extended";
262  break;
263 
265  return "Network Authentication Required";
266  break;
267 
268  // 600+
271  // fall through to default.
272 
273  default:
274  debugs(57, 3, "Unassigned HTTP status code: " << status);
275  }
276  return "Unassigned";
277 }
278 
const char * StatusCodeString(const Http::StatusCode status)
Definition: StatusCode.cc:14
StatusCode
Definition: StatusCode.h:20
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors