]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // |
2 | // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | // | |
7 | // Official repository: https://github.com/boostorg/beast | |
8 | // | |
9 | ||
10 | #ifndef BOOST_BEAST_HTTP_ERROR_HPP | |
11 | #define BOOST_BEAST_HTTP_ERROR_HPP | |
12 | ||
13 | #include <boost/beast/core/detail/config.hpp> | |
14 | #include <boost/beast/core/error.hpp> | |
15 | ||
16 | namespace boost { | |
17 | namespace beast { | |
18 | namespace http { | |
19 | ||
20 | /// Error codes returned from HTTP algorithms and operations. | |
21 | enum class error | |
22 | { | |
23 | /** The end of the stream was reached. | |
24 | ||
25 | This error is returned under the following conditions: | |
26 | ||
27 | @li When attempting to read HTTP data from a stream and the stream | |
28 | read returns the error `boost::asio::error::eof` before any new octets | |
29 | have been received. | |
30 | ||
31 | @li When sending a complete HTTP message at once and the semantics of | |
32 | the message are that the connection should be closed to indicate the | |
33 | end of the message. | |
34 | */ | |
35 | end_of_stream = 1, | |
36 | ||
37 | /** The incoming message is incomplete. | |
38 | ||
39 | This happens when the end of stream is reached during | |
40 | parsing and some octets have been received, but not the | |
41 | entire message. | |
42 | */ | |
43 | partial_message, | |
44 | ||
45 | /** Additional buffers are required. | |
46 | ||
47 | This error is returned during parsing when additional | |
48 | octets are needed. The caller should append more data | |
49 | to the existing buffer and retry the parse operaetion. | |
50 | */ | |
51 | need_more, | |
52 | ||
53 | /** An unexpected body was encountered during parsing. | |
54 | ||
55 | This error is returned when attempting to parse body | |
56 | octets into a message container which has the | |
57 | @ref empty_body body type. | |
58 | ||
59 | @see @ref empty_body | |
60 | */ | |
61 | unexpected_body, | |
62 | ||
63 | /** Additional buffers are required. | |
64 | ||
65 | This error is returned under the following conditions: | |
66 | ||
67 | @li During serialization when using @ref buffer_body. | |
68 | The caller should update the body to point to a new | |
69 | buffer or indicate that there are no more octets in | |
70 | the body. | |
71 | ||
72 | @li During parsing when using @ref buffer_body. | |
73 | The caller should update the body to point to a new | |
74 | storage area to receive additional body octets. | |
75 | */ | |
76 | need_buffer, | |
77 | ||
78 | /** The end of a chunk was reached | |
79 | */ | |
80 | end_of_chunk, | |
81 | ||
82 | /** Buffer maximum exceeded. | |
83 | ||
84 | This error is returned when reading HTTP content | |
85 | into a dynamic buffer, and the operation would | |
86 | exceed the maximum size of the buffer. | |
87 | */ | |
88 | buffer_overflow, | |
89 | ||
90 | /** Header limit exceeded. | |
91 | ||
92 | The parser detected an incoming message header which | |
93 | exceeded a configured limit. | |
94 | */ | |
95 | header_limit, | |
96 | ||
97 | /** Body limit exceeded. | |
98 | ||
99 | The parser detected an incoming message body which | |
100 | exceeded a configured limit. | |
101 | */ | |
102 | body_limit, | |
103 | ||
104 | /** A memory allocation failed. | |
105 | ||
106 | When basic_fields throws std::bad_alloc, it is | |
107 | converted into this error by @ref parser. | |
108 | */ | |
109 | bad_alloc, | |
110 | ||
111 | // | |
112 | // (parser errors) | |
113 | // | |
114 | ||
115 | /// The line ending was malformed | |
116 | bad_line_ending, | |
117 | ||
118 | /// The method is invalid. | |
119 | bad_method, | |
120 | ||
121 | /// The request-target is invalid. | |
122 | bad_target, | |
123 | ||
124 | /// The HTTP-version is invalid. | |
125 | bad_version, | |
126 | ||
127 | /// The status-code is invalid. | |
128 | bad_status, | |
129 | ||
130 | /// The reason-phrase is invalid. | |
131 | bad_reason, | |
132 | ||
133 | /// The field name is invalid. | |
134 | bad_field, | |
135 | ||
136 | /// The field value is invalid. | |
137 | bad_value, | |
138 | ||
139 | /// The Content-Length is invalid. | |
140 | bad_content_length, | |
141 | ||
142 | /// The Transfer-Encoding is invalid. | |
143 | bad_transfer_encoding, | |
144 | ||
145 | /// The chunk syntax is invalid. | |
146 | bad_chunk, | |
147 | ||
148 | /// The chunk extension is invalid. | |
149 | bad_chunk_extension, | |
150 | ||
151 | /// An obs-fold exceeded an internal limit. | |
152 | bad_obs_fold | |
153 | }; | |
154 | ||
155 | } // http | |
156 | } // beast | |
157 | } // boost | |
158 | ||
159 | #include <boost/beast/http/impl/error.ipp> | |
160 | ||
161 | #endif |