Repository navigation
Expand file tree
/
Copy pathforms_verdict.hpp
More file actions
61 lines (45 loc) · 2.22 KB
/
Copy pathforms_verdict.hpp
File metadata and controls
61 lines (45 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
This file is part of libhttpserver
Copyright (C) 2011-2026 Sebastiano Merlino
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the file
LICENSE in the distribution; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
// The rejection-verdict shaping the two form surfaces share (TASK-117
// factored out of form_read so multipart_read is not a copy: the
// duplication gate requires one helper, not one per form). Both
// verdict types answer a typed limit_exceeded with 413 and a typed
// invalid_argument with 400, frame the empty rejection body with an
// explicit Content-Length: 0 (the v2 parity framing), and carry no
// committable status for any other failure (transport, cancellation,
// state -- the runner synthesizes what those need).
#if !defined(HTTPSERVER_COMPILATION)
#error "httpserver/detail/forms_verdict.hpp is internal; only reachable when compiling libhttpserver."
#endif
#ifndef SRC_HTTPSERVER_DETAIL_FORMS_VERDICT_HPP_
#define SRC_HTTPSERVER_DETAIL_FORMS_VERDICT_HPP_
#include <httpserver/http/fields.hpp>
#include <httpserver/http/outcome.hpp>
#include <httpserver/http/status.hpp>
namespace httpserver {
namespace detail {
namespace forms_verdict {
// limit_exceeded -> 413, invalid_argument -> 400, anything else -> an
// invalid status (nothing to commit).
http::status reject_status(const http::outcome& status) noexcept;
// The length-framed empty rejection body.
http::fields reject_fields();
} // namespace forms_verdict
} // namespace detail
} // namespace httpserver
#endif // SRC_HTTPSERVER_DETAIL_FORMS_VERDICT_HPP_