forked from boostorg/beast
A new class `serializer` is introduced to permit incremental serialization of HTTP messages. Existing free functions are re-implemented in terms of this new class. * The BodyReader concept is refined to support a greater variety of strategies for providing buffers representing the body to the serialization algorithms. * Added buffer_body, a new model of Body which allows the caller to provide a series of owned buffers using their own serialization loop. * Added empty_body, a model of Body which is for serialization only, to represent HTTP messages with no content body. * Removed overloads of write and async_write which send only the HTTP header. * Removed public interfaces for performing low-level chunk encoding.
95 lines
2.2 KiB
C++
95 lines
2.2 KiB
C++
//
|
|
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
//
|
|
// 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)
|
|
//
|
|
|
|
#ifndef BEAST_HTTP_ERROR_HPP
|
|
#define BEAST_HTTP_ERROR_HPP
|
|
|
|
#include <beast/config.hpp>
|
|
#include <beast/core/error.hpp>
|
|
|
|
namespace beast {
|
|
namespace http {
|
|
|
|
/// Error codes returned from HTTP parsing
|
|
enum class error
|
|
{
|
|
/** The end of the stream was reached.
|
|
|
|
This error is returned by @ref basic_parser::write_eof
|
|
when the end of stream is reached and there are no
|
|
unparsed bytes in the stream buffer.
|
|
*/
|
|
end_of_stream = 1,
|
|
|
|
/** The incoming message is incomplete.
|
|
|
|
This happens when the end of stream is reached
|
|
and some bytes have been received, but not the
|
|
entire message.
|
|
*/
|
|
partial_message,
|
|
|
|
/** Additional buffers are required.
|
|
|
|
This error is generated during serialization of HTTP
|
|
messages using the @ref buffer_body representation.
|
|
It indicates to the caller that an additional buffer
|
|
sequence should be placed into the body, or that the
|
|
caller should indicate that there are no more bytes
|
|
remaining in the body to serialize.
|
|
*/
|
|
need_more,
|
|
|
|
/** 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,
|
|
|
|
/// The line ending was malformed
|
|
bad_line_ending,
|
|
|
|
/// The method is invalid.
|
|
bad_method,
|
|
|
|
/// The request-target is invalid.
|
|
bad_path,
|
|
|
|
/// 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.
|
|
bad_chunk
|
|
};
|
|
|
|
} // http
|
|
} // beast
|
|
|
|
#include <beast/http/impl/error.ipp>
|
|
|
|
#endif
|