Skip to content

Commit c16c1ce

Browse files
authored
Merge pull request #3 from j-ulrich/feature/addMissingStatusCodes
Feature/add missing status codes
2 parents d27fb3f + 9ef2fc5 commit c16c1ce

File tree

9 files changed

+190
-109
lines changed

9 files changed

+190
-109
lines changed

.appveyor.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ version: "{build}"
33
environment:
44
CTEST_OUTPUT_ON_FAILURE: '1'
55
matrix:
6-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
6+
- CMAKE_GENERATOR: Visual Studio 15 2017 Win64
7+
QT_DIR: C:\Qt\5.11\msvc2017_64
8+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
9+
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"'
10+
- CMAKE_GENERATOR: Visual Studio 14 2015
11+
QT_DIR: C:\Qt\5.9\msvc2015
12+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
713
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86'
8-
CMAKE_GENERATOR: Visual Studio 14 2015
9-
QT_DIR: C:\Qt\5.8\msvc2015
10-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
11-
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86'
12-
CMAKE_GENERATOR: Visual Studio 14 2015
14+
- CMAKE_GENERATOR: Visual Studio 14 2015
1315
QT_DIR: C:\Qt\5.6\msvc2015
14-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
16+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
17+
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86'
18+
- CMAKE_GENERATOR: Visual Studio 12 2013
19+
QT_DIR: C:\Qt\5.6\msvc2013
20+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
1521
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86'
16-
CMAKE_GENERATOR: Visual Studio 12 2013
17-
QT_DIR: C:\Qt\5.8\msvc2013
1822

1923
before_build:
2024
- call %VCVARS_COMMANDLINE%

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog # {#changelog}
2+
3+
\brief The changelog of the http-status-codes library.
4+
5+
This project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
This changelog follows the [Keep a Changelog](http://keepachangelog.com) format.
8+
9+
10+
---
11+
12+
## [1.1.0] - 2018-10-06 ##
13+
Adds missing status codes from the IANA registry.
14+
15+
### Added ###
16+
- Status codes 103 Early Hints, 208 Already Reported, 508 Loop Detected and 510 Not Extended
17+
18+
19+
### Fixed ###
20+
- Removed redundant "HttpStatus_XXX" documentation comments in C variant.
21+
22+
23+
---
24+
25+
26+
## 1.0.0 - 2017-11-02 ##
27+
Initial (actually unversioned) release.
28+
29+
### Added ###
30+
- C, C++, C++11 and Qt variants.
31+
- Status codes
32+
- Category/class tests (`isXXX()` functions)
33+
- Reason phrases
34+
- `QNetworkReply::NetworkError` mapping
35+
36+
37+
---
38+
39+
40+
[1.1.0]: https://github.com/j-ulrich/http-status-codes-cpp/releases/tag/1.1.0

HttpStatusCodes_C++.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* https://github.com/j-ulrich/http-status-codes-cpp
66
*
7-
* \date Created on 06.10.2017
7+
* \version 1.1.0
88
* \author Jochen Ulrich <[email protected]>
99
* \copyright Licensed under Creative Commons CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
1010
*/
@@ -31,6 +31,7 @@ enum Code
3131
Continue = 100, //!< Indicates that the initial part of a request has been received and has not yet been rejected by the server.
3232
SwitchingProtocols = 101, //!< Indicates that the server understands and is willing to comply with the client's request, via the Upgrade header field, for a change in the application protocol being used on this connection.
3333
Processing = 102, //!< Is an interim response used to inform the client that the server has accepted the complete request, but has not yet completed it.
34+
EarlyHints = 103, //!< Indicates to the client that the server is likely to send a final response with the header fields included in the informational response.
3435

3536
/*####### 2xx - Successful #######*/
3637
/* Indicates that the client's request was successfully received,
@@ -44,6 +45,7 @@ enum Code
4445
ResetContent = 205, //!< Indicates that the server has fulfilled the request and desires that the user agent reset the \"document view\", which caused the request to be sent, to its original state as received from the origin server.
4546
PartialContent = 206, //!< Indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the requests's Range header field.
4647
MultiStatus = 207, //!< Provides status for multiple independent operations.
48+
AlreadyReported = 208, //!< Used inside a DAV:propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly. [RFC 5842]
4749
IMUsed = 226, //!< The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
4850

4951
/*####### 3xx - Redirection #######*/
@@ -55,7 +57,8 @@ enum Code
5557
Found = 302, //!< Indicates that the target resource resides temporarily under a different URI.
5658
SeeOther = 303, //!< Indicates that the server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, that is intended to provide an indirect response to the original request.
5759
NotModified = 304, //!< Indicates that a conditional GET request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition has evaluated to false.
58-
UseProxy = 305, //!< \deprecated
60+
UseProxy = 305, //!< \deprecated \parblock Due to security concerns regarding in-band configuration of a proxy. \endparblock
61+
//!< The requested resource MUST be accessed through the proxy given by the Location field.
5962
TemporaryRedirect = 307, //!< Indicates that the target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.
6063
PermanentRedirect = 308, //!< The target resource has been assigned a new permanent URI and any future references to this resource outght to use one of the enclosed URIs. [...] This status code is similar to 301 Moved Permanently (Section 7.3.2 of rfc7231), except that it does not allow rewriting the request method from POST to GET.
6164

@@ -102,6 +105,8 @@ enum Code
102105
HTTPVersionNotSupported = 505, //!< Indicates that the server does not support, or refuses to support, the protocol version that was used in the request message.
103106
VariantAlsoNegotiates = 506, //!< Indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
104107
InsufficientStorage = 507, //!< Means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
108+
LoopDetected = 508, //!< Indicates that the server terminated an operation because it encountered an infinite loop while processing a request with "Depth: infinity". [RFC 5842]
109+
NotExtended = 510, //!< The policy for accessing the resource has not been met in the request. [RFC 2774]
105110
NetworkAuthenticationRequired = 511 //!< Indicates that the client needs to authenticate to gain network access.
106111
};
107112

@@ -126,6 +131,7 @@ inline std::string reasonPhrase(int code)
126131
case 100: return "Continue";
127132
case 101: return "Switching Protocols";
128133
case 102: return "Processing";
134+
case 103: return "Early Hints";
129135

130136
//####### 2xx - Successful #######
131137
case 200: return "OK";
@@ -136,6 +142,7 @@ inline std::string reasonPhrase(int code)
136142
case 205: return "Reset Content";
137143
case 206: return "Partial Content";
138144
case 207: return "Multi-Status";
145+
case 208: return "Already Reported";
139146
case 226: return "IM Used";
140147

141148
//####### 3xx - Redirection #######
@@ -186,6 +193,8 @@ inline std::string reasonPhrase(int code)
186193
case 505: return "HTTP Version Not Supported";
187194
case 506: return "Variant Also Negotiates";
188195
case 507: return "Insufficient Storage";
196+
case 508: return "Loop Detected";
197+
case 510: return "Not Extended";
189198
case 511: return "Network Authentication Required";
190199

191200
default: return std::string();

HttpStatusCodes_C++11.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* https://github.com/j-ulrich/http-status-codes-cpp
66
*
7-
* \date Created on 06.10.2017
7+
* \version 1.1.0
88
* \author Jochen Ulrich <[email protected]>
99
* \copyright Licensed under Creative Commons CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
1010
*/
@@ -32,6 +32,7 @@ enum class Code
3232
Continue = 100, //!< Indicates that the initial part of a request has been received and has not yet been rejected by the server.
3333
SwitchingProtocols = 101, //!< Indicates that the server understands and is willing to comply with the client's request, via the Upgrade header field, for a change in the application protocol being used on this connection.
3434
Processing = 102, //!< Is an interim response used to inform the client that the server has accepted the complete request, but has not yet completed it.
35+
EarlyHints = 103, //!< Indicates to the client that the server is likely to send a final response with the header fields included in the informational response.
3536

3637
/*####### 2xx - Successful #######*/
3738
/* Indicates that the client's request was successfully received,
@@ -45,6 +46,7 @@ enum class Code
4546
ResetContent = 205, //!< Indicates that the server has fulfilled the request and desires that the user agent reset the \"document view\", which caused the request to be sent, to its original state as received from the origin server.
4647
PartialContent = 206, //!< Indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the requests's Range header field.
4748
MultiStatus = 207, //!< Provides status for multiple independent operations.
49+
AlreadyReported = 208, //!< Used inside a DAV:propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly. [RFC 5842]
4850
IMUsed = 226, //!< The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
4951

5052
/*####### 3xx - Redirection #######*/
@@ -56,7 +58,8 @@ enum class Code
5658
Found = 302, //!< Indicates that the target resource resides temporarily under a different URI.
5759
SeeOther = 303, //!< Indicates that the server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, that is intended to provide an indirect response to the original request.
5860
NotModified = 304, //!< Indicates that a conditional GET request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition has evaluated to false.
59-
UseProxy = 305, //!< \deprecated
61+
UseProxy = 305, //!< \deprecated \parblock Due to security concerns regarding in-band configuration of a proxy. \endparblock
62+
//!< The requested resource MUST be accessed through the proxy given by the Location field.
6063
TemporaryRedirect = 307, //!< Indicates that the target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.
6164
PermanentRedirect = 308, //!< The target resource has been assigned a new permanent URI and any future references to this resource outght to use one of the enclosed URIs. [...] This status code is similar to 301 Moved Permanently (Section 7.3.2 of rfc7231), except that it does not allow rewriting the request method from POST to GET.
6265

@@ -103,6 +106,8 @@ enum class Code
103106
HTTPVersionNotSupported = 505, //!< Indicates that the server does not support, or refuses to support, the protocol version that was used in the request message.
104107
VariantAlsoNegotiates = 506, //!< Indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
105108
InsufficientStorage = 507, //!< Means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
109+
LoopDetected = 508, //!< Indicates that the server terminated an operation because it encountered an infinite loop while processing a request with "Depth: infinity". [RFC 5842]
110+
NotExtended = 510, //!< The policy for accessing the resource has not been met in the request. [RFC 2774]
106111
NetworkAuthenticationRequired = 511 //!< Indicates that the client needs to authenticate to gain network access.
107112
};
108113

@@ -134,6 +139,7 @@ inline std::string reasonPhrase(int code)
134139
case 100: return "Continue";
135140
case 101: return "Switching Protocols";
136141
case 102: return "Processing";
142+
case 103: return "Early Hints";
137143

138144
//####### 2xx - Successful #######
139145
case 200: return "OK";
@@ -144,6 +150,7 @@ inline std::string reasonPhrase(int code)
144150
case 205: return "Reset Content";
145151
case 206: return "Partial Content";
146152
case 207: return "Multi-Status";
153+
case 208: return "Already Reported";
147154
case 226: return "IM Used";
148155

149156
//####### 3xx - Redirection #######
@@ -194,6 +201,8 @@ inline std::string reasonPhrase(int code)
194201
case 505: return "HTTP Version Not Supported";
195202
case 506: return "Variant Also Negotiates";
196203
case 507: return "Insufficient Storage";
204+
case 508: return "Loop Detected";
205+
case 510: return "Not Extended";
197206
case 511: return "Network Authentication Required";
198207

199208
default: return std::string();

0 commit comments

Comments
 (0)