1 /*
2  * Copyright (C) 1996-2021 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 #ifndef _SQUID_SRC_HTTP_STATUSCODE_H
10 #define _SQUID_SRC_HTTP_STATUSCODE_H
11 
12 namespace Http
13 {
14 
15 /**
16  * These basic HTTP reply status codes are defined by RFC 2616 unless otherwise stated.
17  * The IANA registry for HTTP status codes can be found at:
18  * http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
19  */
20 typedef enum {
21     scNone = 0,
22     scContinue = 100,
23     scSwitchingProtocols = 101,
24     scProcessing = 102,      /**< RFC2518 section 10.1 */
25     scEarlyHints = 103,      /**< draft-kazuho-early-hints-status-code */
26     scOkay = 200,
27     scCreated = 201,
28     scAccepted = 202,
29     scNonAuthoritativeInformation = 203,
30     scNoContent = 204,
31     scResetContent = 205,
32     scPartialContent = 206,
33     scMultiStatus = 207,     /**< RFC2518 section 10.2 / RFC4918 */
34     scAlreadyReported = 208, /**< RFC5842 */
35     scImUsed = 226,          /**< RFC3229 */
36     scMultipleChoices = 300,
37     scMovedPermanently = 301,
38     scFound = 302,
39     scSeeOther = 303,
40     scNotModified = 304,
41     scUseProxy = 305,
42     scTemporaryRedirect = 307,
43     scPermanentRedirect = 308, /**< RFC7538 */
44     scBadRequest = 400,
45     scUnauthorized = 401,
46     scPaymentRequired = 402,
47     scForbidden = 403,
48     scNotFound = 404,
49     scMethodNotAllowed = 405,
50     scNotAcceptable = 406,
51     scProxyAuthenticationRequired = 407,
52     scRequestTimeout = 408,
53     scConflict = 409,
54     scGone = 410,
55     scLengthRequired = 411,
56     scPreconditionFailed = 412,
57     scPayloadTooLarge = 413,
58     scUriTooLong = 414,
59     scUnsupportedMediaType = 415,
60     scRequestedRangeNotSatisfied = 416,
61     scExpectationFailed = 417,
62     scMisdirectedRequest = 421,     /**< RFC7540 section 9.1.2 */
63     scUnprocessableEntity = 422,    /**< RFC2518 section 10.3 / RFC4918 */
64     scLocked = 423,                 /**< RFC2518 section 10.4 / RFC4918 */
65     scFailedDependency = 424,       /**< RFC2518 section 10.5 / RFC4918 */
66     scUpgradeRequired = 426,
67     scPreconditionRequired = 428,   /**< RFC6585 */
68     scTooManyRequests = 429,        /**< RFC6585 */
69     scRequestHeaderFieldsTooLarge = 431, /**< RFC6585 */
70     scUnavailableForLegalReasons = 451, /**< RFC7725 */
71     scInternalServerError = 500,
72     scNotImplemented = 501,
73     scBadGateway = 502,
74     scServiceUnavailable = 503,
75     scGatewayTimeout = 504,
76     scHttpVersionNotSupported = 505,
77     scVariantAlsoNegotiates = 506,  /**< RFC2295 */
78     scInsufficientStorage = 507,    /**< RFC2518 section 10.6 / RFC4918 */
79     scLoopDetected = 508,           /**< RFC5842 */
80     scNotExtended = 510,            /**< RFC2774 */
81     scNetworkAuthenticationRequired = 511, /**< RFC6585 */
82 
83     // The 6xx codes below are for internal use only: Bad requests result
84     // in scBadRequest; bad responses in scGatewayTimeout.
85 
86     scInvalidHeader = 600,          /**< Squid header parsing error */
87     scHeaderTooLarge = 601         /* Header too large to process */
88 } StatusCode;
89 
90 const char *StatusCodeString(const Http::StatusCode status);
91 
92 } // namespace Http
93 
94 #endif /* _SQUID_SRC_HTTP_STATUSCODE_H */
95 
96