summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-09-08 12:16:31 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-11 12:19:26 -0400
commit1d9709b8abb342b0978a215825cfc78cd2365a11 (patch)
treec33ea538c530d223817e4cdd15947a9e549050b8
parent38620b10bcf5dd00e653e23b608e48357b020456 (diff)
downloadlighttpd-git-1d9709b8abb342b0978a215825cfc78cd2365a11.tar.gz
[core] update HTTP status codes list from IANA
-rw-r--r--src/http_kv.c20
-rw-r--r--src/request.c2
-rwxr-xr-xtests/request.t8
3 files changed, 21 insertions, 9 deletions
diff --git a/src/http_kv.c b/src/http_kv.c
index d10cb27e..7da2bff7 100644
--- a/src/http_kv.c
+++ b/src/http_kv.c
@@ -69,10 +69,12 @@ static const keyvalue http_methods[] = {
{ HTTP_METHOD_UNSET, 0, NULL }
};
+/* https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml */
static const keyvalue http_status[] = {
{ 100, CONST_LEN_STR("100 Continue") },
{ 101, CONST_LEN_STR("101 Switching Protocols") },
{ 102, CONST_LEN_STR("102 Processing") }, /* WebDAV */
+ { 103, CONST_LEN_STR("103 Early Hints") },
{ 200, CONST_LEN_STR("200 OK") },
{ 201, CONST_LEN_STR("201 Created") },
{ 202, CONST_LEN_STR("202 Accepted") },
@@ -81,6 +83,8 @@ static const keyvalue http_status[] = {
{ 205, CONST_LEN_STR("205 Reset Content") },
{ 206, CONST_LEN_STR("206 Partial Content") },
{ 207, CONST_LEN_STR("207 Multi-status") }, /* WebDAV */
+ { 208, CONST_LEN_STR("208 Already Reported") },
+ { 226, CONST_LEN_STR("226 IM Used") },
{ 300, CONST_LEN_STR("300 Multiple Choices") },
{ 301, CONST_LEN_STR("301 Moved Permanently") },
{ 302, CONST_LEN_STR("302 Found") },
@@ -103,23 +107,31 @@ static const keyvalue http_status[] = {
{ 410, CONST_LEN_STR("410 Gone") },
{ 411, CONST_LEN_STR("411 Length Required") },
{ 412, CONST_LEN_STR("412 Precondition Failed") },
- { 413, CONST_LEN_STR("413 Request Entity Too Large") },
- { 414, CONST_LEN_STR("414 Request-URI Too Long") },
+ { 413, CONST_LEN_STR("413 Payload Too Large") },
+ { 414, CONST_LEN_STR("414 URI Too Long") },
{ 415, CONST_LEN_STR("415 Unsupported Media Type") },
- { 416, CONST_LEN_STR("416 Requested Range Not Satisfiable") },
+ { 416, CONST_LEN_STR("416 Range Not Satisfiable") },
{ 417, CONST_LEN_STR("417 Expectation Failed") },
{ 421, CONST_LEN_STR("421 Misdirected Request") }, /* RFC 7540 */
{ 422, CONST_LEN_STR("422 Unprocessable Entity") }, /* WebDAV */
{ 423, CONST_LEN_STR("423 Locked") }, /* WebDAV */
{ 424, CONST_LEN_STR("424 Failed Dependency") }, /* WebDAV */
{ 426, CONST_LEN_STR("426 Upgrade Required") }, /* TLS */
+ { 428, CONST_LEN_STR("428 Precondition Required") },
+ { 429, CONST_LEN_STR("429 Too Many Requests") },
+ { 431, CONST_LEN_STR("431 Request Header Fields Too Large") },
+ { 451, CONST_LEN_STR("451 Unavailable For Legal Reasons") },
{ 500, CONST_LEN_STR("500 Internal Server Error") },
{ 501, CONST_LEN_STR("501 Not Implemented") },
{ 502, CONST_LEN_STR("502 Bad Gateway") },
- { 503, CONST_LEN_STR("503 Service Not Available") },
+ { 503, CONST_LEN_STR("503 Service Unavailable") },
{ 504, CONST_LEN_STR("504 Gateway Timeout") },
{ 505, CONST_LEN_STR("505 HTTP Version Not Supported") },
+ { 506, CONST_LEN_STR("506 Variant Also Negotiates") },
{ 507, CONST_LEN_STR("507 Insufficient Storage") }, /* WebDAV */
+ { 508, CONST_LEN_STR("508 Loop Detected") },
+ { 510, CONST_LEN_STR("510 Not Extended") },
+ { 511, CONST_LEN_STR("511 Network Authentication Required") },
{ -1, 0, NULL }
};
diff --git a/src/request.c b/src/request.c
index 0de0a261..9f646e26 100644
--- a/src/request.c
+++ b/src/request.c
@@ -1006,7 +1006,7 @@ int http_request_parse_target(request_st * const r, int scheme_port) {
len = buffer_string_length(target);
r->rqst_header_len += len;
if (len > MAX_HTTP_REQUEST_URI) {
- return 414; /* 414 Request-URI Too Long */
+ return 414; /* 414 URI Too Long */
}
if (r->rqst_header_len > MAX_HTTP_REQUEST_HEADER) {
log_error(r->conf.errh, __FILE__, __LINE__,
diff --git a/tests/request.t b/tests/request.t
index aa1cace0..75a96350 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -332,10 +332,10 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>416 Requested Range Not Satisfiable</title>
+ <title>416 Range Not Satisfiable</title>
</head>
<body>
- <h1>416 Requested Range Not Satisfiable</h1>
+ <h1>416 Range Not Satisfiable</h1>
</body>
</html>
EOF
@@ -354,10 +354,10 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>416 Requested Range Not Satisfiable</title>
+ <title>416 Range Not Satisfiable</title>
</head>
<body>
- <h1>416 Requested Range Not Satisfiable</h1>
+ <h1>416 Range Not Satisfiable</h1>
</body>
</html>
EOF