Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:03:51

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_HTTP_ERROR_HPP
0011 #define BOOST_BEAST_HTTP_ERROR_HPP
0012 
0013 #include <boost/beast/core/detail/config.hpp>
0014 #include <boost/beast/core/error.hpp>
0015 
0016 namespace boost {
0017 namespace beast {
0018 namespace http {
0019 
0020 /// Error codes returned from HTTP algorithms and operations.
0021 enum class error
0022 {
0023     /** The end of the stream was reached.
0024 
0025         This error is returned when attempting to read HTTP data,
0026         and the stream returns the error `net::error::eof`
0027         before any octets corresponding to a new HTTP message have
0028         been received.
0029     */
0030     end_of_stream = 1,
0031 
0032     /** The incoming message is incomplete.
0033 
0034         This happens when the end of stream is reached during
0035         parsing and some octets have been received, but not the
0036         entire message.
0037     */
0038     partial_message,
0039 
0040     /** Additional buffers are required.
0041 
0042         This error is returned during parsing when additional
0043         octets are needed. The caller should append more data
0044         to the existing buffer and retry the parse operation.
0045     */
0046     need_more,
0047 
0048     /** An unexpected body was encountered during parsing.
0049 
0050         This error is returned when attempting to parse body
0051         octets into a message container which has the
0052         @ref empty_body body type.
0053 
0054         @see empty_body
0055     */
0056     unexpected_body,
0057 
0058     /** Additional buffers are required.
0059 
0060         This error is returned under the following conditions:
0061 
0062         @li During serialization when using @ref buffer_body.
0063         The caller should update the body to point to a new
0064         buffer or indicate that there are no more octets in
0065         the body.
0066 
0067         @li During parsing when using @ref buffer_body.
0068         The caller should update the body to point to a new
0069         storage area to receive additional body octets.
0070     */
0071     need_buffer,
0072 
0073     /** The end of a chunk was reached
0074     */
0075     end_of_chunk,
0076 
0077     /** Buffer maximum exceeded.
0078 
0079         This error is returned when reading HTTP content
0080         into a dynamic buffer, and the operation would
0081         exceed the maximum size of the buffer.
0082     */
0083     buffer_overflow,
0084 
0085     /** Header limit exceeded.
0086 
0087         The parser detected an incoming message header which
0088         exceeded a configured limit.
0089     */
0090     header_limit,
0091 
0092     /** Body limit exceeded.
0093 
0094         The parser detected an incoming message body which
0095         exceeded a configured limit.
0096     */
0097     body_limit,
0098 
0099     /** A memory allocation failed.
0100 
0101         When basic_fields throws std::bad_alloc, it is
0102         converted into this error by @ref parser.
0103     */
0104     bad_alloc,
0105 
0106     //
0107     // (parser errors)
0108     //
0109 
0110     /// The line ending was malformed
0111     bad_line_ending,
0112 
0113     /// The method is invalid.
0114     bad_method,
0115 
0116     /// The request-target is invalid.
0117     bad_target,
0118 
0119     /// The HTTP-version is invalid.
0120     bad_version,
0121 
0122     /// The status-code is invalid.
0123     bad_status,
0124 
0125     /// The reason-phrase is invalid.
0126     bad_reason,
0127 
0128     /// The field name is invalid.
0129     bad_field,
0130 
0131     /// The field value is invalid.
0132     bad_value,
0133 
0134     /// The Content-Length is invalid.
0135     bad_content_length,
0136 
0137     /// The Transfer-Encoding is invalid.
0138     bad_transfer_encoding,
0139 
0140     /// The chunk syntax is invalid.
0141     bad_chunk,
0142 
0143     /// The chunk extension is invalid.
0144     bad_chunk_extension,
0145 
0146     /// An obs-fold exceeded an internal limit.
0147     bad_obs_fold,
0148 
0149     /// The response contains multiple and conflicting Content-Length.
0150     multiple_content_length,
0151 
0152     /** The parser is stale.
0153 
0154         This happens when attempting to re-use a parser that has
0155         already completed parsing a message. Programs must construct
0156         a new parser for each message. This can be easily done by
0157         storing the parser in an boost or std::optional container.
0158     */
0159     stale_parser,
0160 
0161     /** The message body is shorter than expected.
0162 
0163         This error is returned by @ref file_body when an unexpected
0164         unexpected end-of-file condition is encountered while trying
0165         to read from the file.
0166     */
0167     short_read
0168 };
0169 
0170 } // http
0171 } // beast
0172 } // boost
0173 
0174 #include <boost/beast/http/impl/error.hpp>
0175 #ifdef BOOST_BEAST_HEADER_ONLY
0176 #include <boost/beast/http/impl/error.ipp>
0177 #endif
0178 
0179 #endif