From bb2daeda2b58a08c4223d1c8fea5307597f9a60b Mon Sep 17 00:00:00 2001 From: Gulliver Date: Wed, 11 Feb 2026 23:28:59 +0100 Subject: [PATCH] added http status codes from RFC 2518 (WebDAV) --- include/crow/common.h | 12 ++++++++++-- include/crow/http_response.h | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/crow/common.h b/include/crow/common.h index ca3ca7eae..a8e58f4ab 100644 --- a/include/crow/common.h +++ b/include/crow/common.h @@ -176,7 +176,7 @@ namespace crow NO_CONTENT = 204, RESET_CONTENT = 205, PARTIAL_CONTENT = 206, - + WEBDAV_MULTI_STATUS = 207, MULTIPLE_CHOICES = 300, MOVED_PERMANENTLY = 301, FOUND = 302, @@ -198,6 +198,13 @@ namespace crow UNSUPPORTED_MEDIA_TYPE = 415, RANGE_NOT_SATISFIABLE = 416, EXPECTATION_FAILED = 417, + + WEBDAV_PRECONDITION_FAILED = 412, + WEBDAV_REQUEST_URI_TOO_LONG = 414, + WEBDAV_UNPROCESSABLE_ENTITY = 422, + WEBDAV_LOCKED = 423, + WEBDAV_FAILED_DEPENDENCY = 424, + PRECONDITION_REQUIRED = 428, TOO_MANY_REQUESTS = 429, UNAVAILABLE_FOR_LEGAL_REASONS = 451, @@ -207,7 +214,8 @@ namespace crow BAD_GATEWAY = 502, SERVICE_UNAVAILABLE = 503, GATEWAY_TIMEOUT = 504, - VARIANT_ALSO_NEGOTIATES = 506 + VARIANT_ALSO_NEGOTIATES = 506, + WEBDAV_INSUFFICIENT_STORAGE = 507 }; // clang-format on diff --git a/include/crow/http_response.h b/include/crow/http_response.h index 74834685d..ac5ced4de 100644 --- a/include/crow/http_response.h +++ b/include/crow/http_response.h @@ -352,7 +352,7 @@ namespace crow {status::NO_CONTENT, "HTTP/1.1 204 No Content\r\n"}, {status::RESET_CONTENT, "HTTP/1.1 205 Reset Content\r\n"}, {status::PARTIAL_CONTENT, "HTTP/1.1 206 Partial Content\r\n"}, - + {status::WEBDAV_MULTI_STATUS, "HTTP/1.1 207 Multi-Status\r\n"}, {status::MULTIPLE_CHOICES, "HTTP/1.1 300 Multiple Choices\r\n"}, {status::MOVED_PERMANENTLY, "HTTP/1.1 301 Moved Permanently\r\n"}, {status::FOUND, "HTTP/1.1 302 Found\r\n"}, @@ -374,6 +374,11 @@ namespace crow {status::UNSUPPORTED_MEDIA_TYPE, "HTTP/1.1 415 Unsupported Media Type\r\n"}, {status::RANGE_NOT_SATISFIABLE, "HTTP/1.1 416 Range Not Satisfiable\r\n"}, {status::EXPECTATION_FAILED, "HTTP/1.1 417 Expectation Failed\r\n"}, + {status::WEBDAV_PRECONDITION_FAILED, "HTTP/1.1 412 Precondition Failed\r\n"}, + {status::WEBDAV_REQUEST_URI_TOO_LONG, "HTTP/1.1 414 Request-URI Too Long\r\n"}, + {status::WEBDAV_UNPROCESSABLE_ENTITY, "HTTP/1.1 422 Unprocessable Entity\r\n"}, + {status::WEBDAV_LOCKED, "HTTP/1.1 423 Locked\r\n"}, + {status::WEBDAV_FAILED_DEPENDENCY, "HTTP/1.1 424 Failed Dependency\r\n"}, {status::PRECONDITION_REQUIRED, "HTTP/1.1 428 Precondition Required\r\n"}, {status::TOO_MANY_REQUESTS, "HTTP/1.1 429 Too Many Requests\r\n"}, {status::UNAVAILABLE_FOR_LEGAL_REASONS, "HTTP/1.1 451 Unavailable For Legal Reasons\r\n"}, @@ -384,7 +389,8 @@ namespace crow {status::SERVICE_UNAVAILABLE, "HTTP/1.1 503 Service Unavailable\r\n"}, {status::GATEWAY_TIMEOUT, "HTTP/1.1 504 Gateway Timeout\r\n"}, {status::VARIANT_ALSO_NEGOTIATES, "HTTP/1.1 506 Variant Also Negotiates\r\n"}, - }; + {status::WEBDAV_INSUFFICIENT_STORAGE, "HTTP/1.1 507 Insufficient Storage\r\n"}, + }; static const std::string seperator = ": ";