]> git.ipfire.org Git - thirdparty/squid.git/blame - src/http/StatusCode.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / http / StatusCode.h
CommitLineData
bbc27441 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
bbc27441
AJ
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
955394ce
AJ
9#ifndef _SQUID_SRC_HTTP_STATUSCODE_H
10#define _SQUID_SRC_HTTP_STATUSCODE_H
11
8b9ade31
A
12namespace Http
13{
955394ce
AJ
14
15/**
16 * These basic HTTP reply status codes are defined by RFC 2616 unless otherwise stated.
f11c8e2f
AJ
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
955394ce
AJ
19 */
20typedef enum {
21 scNone = 0,
22 scContinue = 100,
23 scSwitchingProtocols = 101,
24 scProcessing = 102, /**< RFC2518 section 10.1 */
375008c6 25 scEarlyHints = 103, /**< draft-kazuho-early-hints-status-code */
955394ce
AJ
26 scOkay = 200,
27 scCreated = 201,
28 scAccepted = 202,
29 scNonAuthoritativeInformation = 203,
30 scNoContent = 204,
31 scResetContent = 205,
32 scPartialContent = 206,
f11c8e2f
AJ
33 scMultiStatus = 207, /**< RFC2518 section 10.2 / RFC4918 */
34 scAlreadyReported = 208, /**< RFC5842 */
35 scImUsed = 226, /**< RFC3229 */
955394ce
AJ
36 scMultipleChoices = 300,
37 scMovedPermanently = 301,
f11c8e2f 38 scFound = 302,
955394ce
AJ
39 scSeeOther = 303,
40 scNotModified = 304,
41 scUseProxy = 305,
42 scTemporaryRedirect = 307,
51c27285 43 scPermanentRedirect = 308, /**< RFC7538 */
955394ce
AJ
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,
f11c8e2f
AJ
57 scPayloadTooLarge = 413,
58 scUriTooLong = 414,
955394ce
AJ
59 scUnsupportedMediaType = 415,
60 scRequestedRangeNotSatisfied = 416,
61 scExpectationFailed = 417,
c27e1e37 62 scMisdirectedRequest = 421, /**< RFC7540 section 9.1.2 */
f11c8e2f
AJ
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,
955394ce 67 scPreconditionRequired = 428, /**< RFC6585 */
f11c8e2f 68 scTooManyRequests = 429, /**< RFC6585 */
955394ce 69 scRequestHeaderFieldsTooLarge = 431, /**< RFC6585 */
6fb73c28 70 scUnavailableForLegalReasons = 451, /**< RFC7725 */
955394ce
AJ
71 scInternalServerError = 500,
72 scNotImplemented = 501,
73 scBadGateway = 502,
74 scServiceUnavailable = 503,
f11c8e2f 75 scGatewayTimeout = 504,
955394ce 76 scHttpVersionNotSupported = 505,
f11c8e2f
AJ
77 scVariantAlsoNegotiates = 506, /**< RFC2295 */
78 scInsufficientStorage = 507, /**< RFC2518 section 10.6 / RFC4918 */
79 scLoopDetected = 508, /**< RFC5842 */
80 scNotExtended = 510, /**< RFC2774 */
955394ce
AJ
81 scNetworkAuthenticationRequired = 511, /**< RFC6585 */
82
83 // The 6xx codes below are for internal use only: Bad requests result
f11c8e2f 84 // in scBadRequest; bad responses in scGatewayTimeout.
955394ce
AJ
85
86 scInvalidHeader = 600, /**< Squid header parsing error */
87 scHeaderTooLarge = 601 /* Header too large to process */
88} StatusCode;
89
9b769c67 90const char *StatusCodeString(const Http::StatusCode status);
4f1c93a7
EB
91/// whether this is an informational 1xx response status code
92inline bool Is1xx(const int sc) { return scContinue <= sc && sc < scOkay; }
93/// whether this response status code prohibits sending Content-Length
94inline bool ProhibitsContentLength(const StatusCode sc) { return sc == scNoContent || Is1xx(sc); }
9b769c67 95
955394ce
AJ
96} // namespace Http
97
98#endif /* _SQUID_SRC_HTTP_STATUSCODE_H */
f53969cc 99