mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 14:54:32 +02:00
@@ -1,6 +1,7 @@
|
||||
Version 69:
|
||||
|
||||
* basic_parser optimizations
|
||||
* Use BEAST_FALLTHROUGH to silence warnings
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
20
include/beast/core/detail/config.hpp
Normal file
20
include/beast/core/detail/config.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// 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_CORE_DETAIL_CONFIG_HPP
|
||||
#define BEAST_CORE_DETAIL_CONFIG_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 106500 || ! defined(BOOST_GCC) || BOOST_GCC < 70000
|
||||
# define BEAST_FALLTHROUGH BOOST_FALLTHROUGH
|
||||
#else
|
||||
# define BEAST_FALLTHROUGH _attribute__((fallthrough))
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -12,11 +12,11 @@
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/core/handler_ptr.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -121,7 +121,7 @@ read_some_op<MutableBufferSequence, Handler>::operator()(
|
||||
|
||||
case 2:
|
||||
s_.sb_.commit(bytes_transferred);
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case 3:
|
||||
bytes_transferred =
|
||||
|
@@ -11,10 +11,10 @@
|
||||
#include <beast/core/static_string.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/clamp.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <beast/http/error.hpp>
|
||||
#include <beast/http/rfc7230.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
@@ -178,7 +178,7 @@ loop:
|
||||
return 0;
|
||||
}
|
||||
state_ = state::header;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case state::header:
|
||||
parse_header(p, n, ec);
|
||||
@@ -191,7 +191,7 @@ loop:
|
||||
if(ec)
|
||||
goto done;
|
||||
state_ = state::body;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case state::body:
|
||||
parse_body(p, n, ec);
|
||||
@@ -204,7 +204,7 @@ loop:
|
||||
if(ec)
|
||||
goto done;
|
||||
state_ = state::body_to_eof;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case state::body_to_eof:
|
||||
parse_body_to_eof(p, n, ec);
|
||||
@@ -217,7 +217,7 @@ loop:
|
||||
if(ec)
|
||||
goto done;
|
||||
state_ = state::chunk_header;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case state::chunk_header:
|
||||
parse_chunk_header(p, n, ec);
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <beast/http/error.hpp>
|
||||
#include <beast/http/status.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace beast {
|
||||
@@ -63,7 +63,7 @@ get(error_code& ec, Visit&& visit)
|
||||
if(frd_->chunked())
|
||||
goto go_init_c;
|
||||
s_ = do_init;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case do_init:
|
||||
@@ -86,7 +86,7 @@ get(error_code& ec, Visit&& visit)
|
||||
frd_->get(),
|
||||
result->first};
|
||||
s_ = do_header;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case do_header:
|
||||
@@ -108,7 +108,7 @@ get(error_code& ec, Visit&& visit)
|
||||
return;
|
||||
}
|
||||
s_ = do_body + 1;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_body + 1:
|
||||
{
|
||||
@@ -120,7 +120,7 @@ get(error_code& ec, Visit&& visit)
|
||||
more_ = result->second;
|
||||
v_ = cb1_t{result->first};
|
||||
s_ = do_body + 2;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case do_body + 2:
|
||||
@@ -162,7 +162,7 @@ get(error_code& ec, Visit&& visit)
|
||||
result->first,
|
||||
detail::chunk_crlf()};
|
||||
s_ = do_header_c;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case do_header_c:
|
||||
@@ -184,7 +184,7 @@ get(error_code& ec, Visit&& visit)
|
||||
return;
|
||||
}
|
||||
s_ = do_body_c + 1;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_body_c + 1:
|
||||
{
|
||||
@@ -209,7 +209,7 @@ get(error_code& ec, Visit&& visit)
|
||||
result->first,
|
||||
detail::chunk_crlf()};
|
||||
s_ = do_body_c + 2;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
}
|
||||
|
||||
case do_body_c + 2:
|
||||
@@ -231,7 +231,7 @@ get(error_code& ec, Visit&& visit)
|
||||
}(),
|
||||
detail::chunk_crlf()};
|
||||
s_ = do_final_c + 1;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_final_c + 1:
|
||||
visit(ec, boost::get<ch2_t>(v_));
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef BEAST_HTTP_IMPL_STATUS_IPP
|
||||
#define BEAST_HTTP_IMPL_STATUS_IPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace beast {
|
||||
@@ -25,7 +25,7 @@ int_to_status(unsigned v)
|
||||
case status::continue_:
|
||||
case status::switching_protocols:
|
||||
case status::processing:
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
// 2xx
|
||||
case status::ok:
|
||||
@@ -38,7 +38,7 @@ int_to_status(unsigned v)
|
||||
case status::multi_status:
|
||||
case status::already_reported:
|
||||
case status::im_used:
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
// 3xx
|
||||
case status::multiple_choices:
|
||||
@@ -49,7 +49,7 @@ int_to_status(unsigned v)
|
||||
case status::use_proxy:
|
||||
case status::temporary_redirect:
|
||||
case status::permanent_redirect:
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
// 4xx
|
||||
case status::bad_request:
|
||||
@@ -81,7 +81,7 @@ int_to_status(unsigned v)
|
||||
case status::connection_closed_without_response:
|
||||
case status::unavailable_for_legal_reasons:
|
||||
case status::client_closed_request:
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
// 5xx
|
||||
case status::internal_server_error:
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef BEAST_HTTP_IMPL_VERB_IPP
|
||||
#define BEAST_HTTP_IMPL_VERB_IPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -156,7 +156,7 @@ string_to_verb(string_view v)
|
||||
return verb::connect;
|
||||
if(eq(v, "PY"))
|
||||
return verb::copy;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -217,7 +217,7 @@ string_to_verb(string_view v)
|
||||
case 'O':
|
||||
if(eq(v, "VE"))
|
||||
return verb::move;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -261,7 +261,7 @@ string_to_verb(string_view v)
|
||||
return verb::purge;
|
||||
if(eq(v, "T"))
|
||||
return verb::put;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@@ -14,11 +14,11 @@
|
||||
#include <beast/core/handler_alloc.hpp>
|
||||
#include <beast/core/handler_ptr.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <ostream>
|
||||
@@ -320,7 +320,7 @@ operator()(error_code ec,
|
||||
|
||||
case 2:
|
||||
state_ = 3;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case 3:
|
||||
{
|
||||
|
@@ -11,10 +11,10 @@
|
||||
#include <beast/core/handler_ptr.hpp>
|
||||
#include <beast/core/static_buffer.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <memory>
|
||||
|
||||
@@ -154,7 +154,7 @@ operator()(error_code ec, bool again)
|
||||
return;
|
||||
}
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case 1:
|
||||
// send close frame
|
||||
|
@@ -11,11 +11,11 @@
|
||||
#include <beast/core/bind_handler.hpp>
|
||||
#include <beast/core/handler_ptr.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <beast/websocket/detail/frame.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <memory>
|
||||
|
||||
@@ -153,7 +153,7 @@ operator()(error_code ec, bool again)
|
||||
return;
|
||||
}
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case 1:
|
||||
// send ping frame
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <beast/core/static_buffer.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/clamp.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
@@ -523,7 +524,7 @@ operator()(error_code ec,
|
||||
ec = boost::asio::error::operation_aborted;
|
||||
goto upcall;
|
||||
}
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
@@ -1070,7 +1071,7 @@ operator()(error_code const& ec, bool fin)
|
||||
|
||||
case 1:
|
||||
state_ = 2;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case 2:
|
||||
if(ec)
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <beast/core/static_buffer.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/clamp.hpp>
|
||||
#include <beast/core/detail/config.hpp>
|
||||
#include <beast/websocket/detail/frame.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
@@ -231,7 +232,7 @@ operator()(error_code ec,
|
||||
case do_nomask_nofrag:
|
||||
BOOST_ASSERT(! d.ws.wr_block_);
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_nomask_nofrag + 1:
|
||||
{
|
||||
@@ -254,7 +255,7 @@ operator()(error_code ec,
|
||||
case do_nomask_frag:
|
||||
BOOST_ASSERT(! d.ws.wr_block_);
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_nomask_frag + 1:
|
||||
{
|
||||
@@ -302,7 +303,7 @@ operator()(error_code ec,
|
||||
case do_mask_nofrag:
|
||||
BOOST_ASSERT(! d.ws.wr_block_);
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_mask_nofrag + 1:
|
||||
{
|
||||
@@ -354,7 +355,7 @@ operator()(error_code ec,
|
||||
case do_mask_frag:
|
||||
BOOST_ASSERT(! d.ws.wr_block_);
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_mask_frag + 1:
|
||||
{
|
||||
@@ -407,7 +408,7 @@ operator()(error_code ec,
|
||||
case do_deflate:
|
||||
BOOST_ASSERT(! d.ws.wr_block_);
|
||||
d.ws.wr_block_ = &d;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
|
||||
case do_deflate + 1:
|
||||
{
|
||||
@@ -634,7 +635,7 @@ operator()(error_code ec)
|
||||
{
|
||||
case 2:
|
||||
d.step = 3;
|
||||
BOOST_FALLTHROUGH;
|
||||
BEAST_FALLTHROUGH;
|
||||
case 3:
|
||||
case 0:
|
||||
{
|
||||
|
@@ -5,13 +5,23 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable: 4127) // conditional expression is constant
|
||||
# pragma warning (disable: 4244) // integer conversion, possible loss of data
|
||||
#endif
|
||||
|
||||
#include "nodejs-parser/http_parser.c"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user