StatusCode.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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 
@ scNetworkAuthenticationRequired
Definition: StatusCode.h:81
@ scMethodNotAllowed
Definition: StatusCode.h:49
@ scAccepted
Definition: StatusCode.h:28
@ scNonAuthoritativeInformation
Definition: StatusCode.h:29
@ scUnauthorized
Definition: StatusCode.h:45
@ scPayloadTooLarge
Definition: StatusCode.h:57
@ scProcessing
Definition: StatusCode.h:24
@ scImUsed
Definition: StatusCode.h:35
@ scBadRequest
Definition: StatusCode.h:44
@ scNone
Definition: StatusCode.h:21
@ scResetContent
Definition: StatusCode.h:31
@ scMisdirectedRequest
Definition: StatusCode.h:62
const char * StatusCodeString(const Http::StatusCode status)
Definition: StatusCode.cc:14
@ scLengthRequired
Definition: StatusCode.h:55
@ scUnsupportedMediaType
Definition: StatusCode.h:59
@ scUseProxy
Definition: StatusCode.h:41
@ scVariantAlsoNegotiates
Definition: StatusCode.h:77
@ scMovedPermanently
Definition: StatusCode.h:37
StatusCode
Definition: StatusCode.h:20
@ scRequestedRangeNotSatisfied
Definition: StatusCode.h:60
@ scSeeOther
Definition: StatusCode.h:39
@ scNotAcceptable
Definition: StatusCode.h:50
@ scGatewayTimeout
Definition: StatusCode.h:75
@ scTemporaryRedirect
Definition: StatusCode.h:42
@ scFailedDependency
Definition: StatusCode.h:65
@ scSwitchingProtocols
Definition: StatusCode.h:23
@ scForbidden
Definition: StatusCode.h:47
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:128
@ scInsufficientStorage
Definition: StatusCode.h:78
@ scNotImplemented
Definition: StatusCode.h:72
@ scPreconditionFailed
Definition: StatusCode.h:56
@ scTooManyRequests
Definition: StatusCode.h:68
@ scBadGateway
Definition: StatusCode.h:73
@ scPartialContent
Definition: StatusCode.h:32
@ scGone
Definition: StatusCode.h:54
@ scLoopDetected
Definition: StatusCode.h:79
@ scUnavailableForLegalReasons
Definition: StatusCode.h:70
@ scUnprocessableEntity
Definition: StatusCode.h:63
@ scCreated
Definition: StatusCode.h:27
@ scPermanentRedirect
Definition: StatusCode.h:43
@ scRequestHeaderFieldsTooLarge
Definition: StatusCode.h:69
@ scUriTooLong
Definition: StatusCode.h:58
@ scContinue
Definition: StatusCode.h:22
@ scServiceUnavailable
Definition: StatusCode.h:74
@ scInternalServerError
Definition: StatusCode.h:71
@ scNotModified
Definition: StatusCode.h:40
@ scUpgradeRequired
Definition: StatusCode.h:66
@ scHttpVersionNotSupported
Definition: StatusCode.h:76
@ scFound
Definition: StatusCode.h:38
@ scRequestTimeout
Definition: StatusCode.h:52
@ scEarlyHints
Definition: StatusCode.h:25
@ scNotFound
Definition: StatusCode.h:48
@ scNotExtended
Definition: StatusCode.h:80
@ scPreconditionRequired
Definition: StatusCode.h:67
@ scNoContent
Definition: StatusCode.h:30
@ scProxyAuthenticationRequired
Definition: StatusCode.h:51
@ scInvalidHeader
Definition: StatusCode.h:86
@ scPaymentRequired
Definition: StatusCode.h:46
@ scLocked
Definition: StatusCode.h:64
@ scConflict
Definition: StatusCode.h:53
@ scMultiStatus
Definition: StatusCode.h:33
@ scMultipleChoices
Definition: StatusCode.h:36
@ scOkay
Definition: StatusCode.h:26
@ scHeaderTooLarge
Definition: StatusCode.h:87
@ scAlreadyReported
Definition: StatusCode.h:34
@ scExpectationFailed
Definition: StatusCode.h:61

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors