Files
boost_beast/include/boost/beast/http/error.hpp
T

169 lines
4.1 KiB
C++
Raw Normal View History

2016-11-20 07:32:41 -05:00
//
2019-02-21 07:00:31 -08:00
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
2016-11-20 07:32:41 -05:00
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
2017-07-20 13:40:34 -07:00
// Official repository: https://github.com/boostorg/beast
//
2016-11-20 07:32:41 -05:00
2017-07-20 13:40:34 -07:00
#ifndef BOOST_BEAST_HTTP_ERROR_HPP
#define BOOST_BEAST_HTTP_ERROR_HPP
2016-11-20 07:32:41 -05:00
2017-10-10 07:49:03 -07:00
#include <boost/beast/core/detail/config.hpp>
2017-07-20 13:40:34 -07:00
#include <boost/beast/core/error.hpp>
2016-11-20 07:32:41 -05:00
2017-07-20 13:40:34 -07:00
namespace boost {
2016-11-20 07:32:41 -05:00
namespace beast {
namespace http {
/// Error codes returned from HTTP algorithms and operations.
2016-11-20 07:32:41 -05:00
enum class error
{
/** The end of the stream was reached.
2018-02-21 08:45:08 -08:00
This error is returned when attempting to read HTTP data,
2018-11-30 14:58:38 -08:00
and the stream returns the error `net::error::eof`
2018-02-21 08:45:08 -08:00
before any octets corresponding to a new HTTP message have
been received.
2016-11-20 07:32:41 -05:00
*/
end_of_stream = 1,
/** The incoming message is incomplete.
This happens when the end of stream is reached during
parsing and some octets have been received, but not the
2016-11-20 07:32:41 -05:00
entire message.
*/
partial_message,
2017-05-08 12:41:45 -07:00
/** Additional buffers are required.
This error is returned during parsing when additional
octets are needed. The caller should append more data
to the existing buffer and retry the parse operaetion.
2017-05-08 12:41:45 -07:00
*/
need_more,
2017-06-04 15:05:23 -07:00
/** An unexpected body was encountered during parsing.
This error is returned when attempting to parse body
octets into a message container which has the
@ref empty_body body type.
@see @ref empty_body
*/
2017-06-04 15:05:23 -07:00
unexpected_body,
/** Additional buffers are required.
This error is returned under the following conditions:
@li During serialization when using @ref buffer_body.
The caller should update the body to point to a new
buffer or indicate that there are no more octets in
the body.
@li During parsing when using @ref buffer_body.
The caller should update the body to point to a new
storage area to receive additional body octets.
*/
need_buffer,
2017-07-12 18:06:36 -07:00
/** The end of a chunk was reached
*/
end_of_chunk,
2016-11-20 07:32:41 -05:00
/** Buffer maximum exceeded.
This error is returned when reading HTTP content
into a dynamic buffer, and the operation would
exceed the maximum size of the buffer.
*/
buffer_overflow,
2017-06-27 21:00:53 -07:00
/** Header limit exceeded.
The parser detected an incoming message header which
exceeded a configured limit.
*/
header_limit,
/** Body limit exceeded.
The parser detected an incoming message body which
exceeded a configured limit.
*/
body_limit,
2017-06-23 02:22:15 -07:00
/** A memory allocation failed.
When basic_fields throws std::bad_alloc, it is
converted into this error by @ref parser.
*/
bad_alloc,
//
// (parser errors)
//
2016-11-20 07:32:41 -05:00
/// The line ending was malformed
bad_line_ending,
/// The method is invalid.
bad_method,
/// The request-target is invalid.
2017-06-25 17:18:02 -07:00
bad_target,
2016-11-20 07:32:41 -05:00
/// The HTTP-version is invalid.
bad_version,
/// The status-code is invalid.
bad_status,
/// The reason-phrase is invalid.
bad_reason,
/// The field name is invalid.
bad_field,
/// The field value is invalid.
bad_value,
/// The Content-Length is invalid.
bad_content_length,
/// The Transfer-Encoding is invalid.
bad_transfer_encoding,
/// The chunk syntax is invalid.
2017-06-11 09:58:57 -07:00
bad_chunk,
2017-07-12 18:06:36 -07:00
/// The chunk extension is invalid.
bad_chunk_extension,
2017-06-11 09:58:57 -07:00
/// An obs-fold exceeded an internal limit.
2019-02-28 10:27:43 -08:00
bad_obs_fold,
/** The parser is stale.
This happens when attempting to re-use a parser that has
already completed parsing a message. Programs must construct
a new parser for each message. This can be easily done by
storing the parser in an boost or std::optional container.
*/
stale_parser
2016-11-20 07:32:41 -05:00
};
} // http
} // beast
2017-07-20 13:40:34 -07:00
} // boost
2016-11-20 07:32:41 -05:00
2019-02-22 13:06:43 -08:00
#include <boost/beast/http/impl/error.hpp>
#ifdef BOOST_BEAST_HEADER_ONLY
#include <boost/beast/http/impl/error.ipp>
#endif
2016-11-20 07:32:41 -05:00
#endif