mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Use new beast::http::message:
This commit is contained in:
@@ -301,6 +301,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\detail\unit_test\thread.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\detail\unit_test\thread.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\detail\write_streambuf.hpp">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\handler_alloc.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\handler_alloc.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\basic_headers.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\basic_headers.hpp">
|
||||||
@@ -309,9 +311,7 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\chunk_encode.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\chunk_encode.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\error.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\detail\basic_parser.hpp">
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\writes.hpp">
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\write_preparation.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\detail\write_preparation.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -325,8 +325,6 @@
|
|||||||
</None>
|
</None>
|
||||||
<None Include="..\..\src\beast\include\beast\http\impl\basic_parser.ipp">
|
<None Include="..\..\src\beast\include\beast\http\impl\basic_parser.ipp">
|
||||||
</None>
|
</None>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\impl\http_parser.h">
|
|
||||||
</ClInclude>
|
|
||||||
<None Include="..\..\src\beast\include\beast\http\impl\message.ipp">
|
<None Include="..\..\src\beast\include\beast\http\impl\message.ipp">
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\..\src\beast\include\beast\http\impl\read.ipp">
|
<None Include="..\..\src\beast\include\beast\http\impl\read.ipp">
|
||||||
@@ -339,6 +337,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\parser.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\parser.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\http\parse_error.hpp">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\read.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\read.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\reason.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\reason.hpp">
|
||||||
@@ -347,16 +347,22 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\rfc2616.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\rfc2616.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\http\rfc7230.hpp">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\streambuf_body.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\streambuf_body.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\string_body.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\string_body.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\type_check.hpp">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\write.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\write.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<None Include="..\..\src\beast\include\beast\impl\basic_streambuf.ipp">
|
<None Include="..\..\src\beast\include\beast\impl\basic_streambuf.ipp">
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\consuming_buffers.ipp">
|
||||||
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\prepare_buffers.ipp">
|
||||||
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\static_streambuf.ipp">
|
||||||
|
</None>
|
||||||
<None Include="..\..\src\beast\include\beast\impl\streambuf_readstream.ipp">
|
<None Include="..\..\src\beast\include\beast\impl\streambuf_readstream.ipp">
|
||||||
</None>
|
</None>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\placeholders.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\placeholders.hpp">
|
||||||
@@ -375,6 +381,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\decorator.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\decorator.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\endian.hpp">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\error.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\error.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\frame.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\frame.hpp">
|
||||||
@@ -427,11 +435,17 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\teardown.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\teardown.hpp">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\src\beast_http_nodejs_parser.cpp">
|
<ClInclude Include="..\..\src\beast\include\beast\write_streambuf.hpp">
|
||||||
</ClCompile>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\src\http-parser\http_parser.c">
|
<ClCompile Include="..\..\src\beast\test\http\nodejs-parser\http_parser.c">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\..\src\beast\test\http\nodejs-parser\http_parser.h">
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\beast\test\http\nodejs_parser.cpp">
|
||||||
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\..\src\beast\test\http\nodejs_parser.hpp">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-32bit.h">
|
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-32bit.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-64bit.h">
|
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-64bit.h">
|
||||||
|
|||||||
@@ -478,11 +478,14 @@
|
|||||||
<Filter Include="sqlite\sqlite">
|
<Filter Include="sqlite\sqlite">
|
||||||
<UniqueIdentifier>{D2A046B6-8986-92AC-082F-15B3A01B8E40}</UniqueIdentifier>
|
<UniqueIdentifier>{D2A046B6-8986-92AC-082F-15B3A01B8E40}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="src">
|
<Filter Include="test">
|
||||||
<UniqueIdentifier>{04C492A5-B8E8-3B1F-4337-A067B40F268A}</UniqueIdentifier>
|
<UniqueIdentifier>{D5859751-012E-81F5-D121-159FE9A25436}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="src\http-parser">
|
<Filter Include="test\http">
|
||||||
<UniqueIdentifier>{1E761797-5D00-57DD-FEBA-D17E07E1788D}</UniqueIdentifier>
|
<UniqueIdentifier>{F9ABC269-E86E-1034-C5DE-E9E5B48772DB}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="test\http\nodejs-parser">
|
||||||
|
<UniqueIdentifier>{617863D3-DC6A-1DDA-ACA5-7DC92DCEAFB3}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="websocketpp_02">
|
<Filter Include="websocketpp_02">
|
||||||
<UniqueIdentifier>{96CE200F-2670-323E-3B37-B90DBC0EDA11}</UniqueIdentifier>
|
<UniqueIdentifier>{96CE200F-2670-323E-3B37-B90DBC0EDA11}</UniqueIdentifier>
|
||||||
@@ -630,6 +633,9 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\detail\unit_test\thread.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\detail\unit_test\thread.hpp">
|
||||||
<Filter>include\beast\detail\unit_test</Filter>
|
<Filter>include\beast\detail\unit_test</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\detail\write_streambuf.hpp">
|
||||||
|
<Filter>include\beast\detail</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\handler_alloc.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\handler_alloc.hpp">
|
||||||
<Filter>include\beast</Filter>
|
<Filter>include\beast</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -642,10 +648,7 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\http\chunk_encode.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\chunk_encode.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\error.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\detail\basic_parser.hpp">
|
||||||
<Filter>include\beast\http\detail</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\writes.hpp">
|
|
||||||
<Filter>include\beast\http\detail</Filter>
|
<Filter>include\beast\http\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\detail\write_preparation.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\detail\write_preparation.hpp">
|
||||||
@@ -666,9 +669,6 @@
|
|||||||
<None Include="..\..\src\beast\include\beast\http\impl\basic_parser.ipp">
|
<None Include="..\..\src\beast\include\beast\http\impl\basic_parser.ipp">
|
||||||
<Filter>include\beast\http\impl</Filter>
|
<Filter>include\beast\http\impl</Filter>
|
||||||
</None>
|
</None>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\impl\http_parser.h">
|
|
||||||
<Filter>include\beast\http\impl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<None Include="..\..\src\beast\include\beast\http\impl\message.ipp">
|
<None Include="..\..\src\beast\include\beast\http\impl\message.ipp">
|
||||||
<Filter>include\beast\http\impl</Filter>
|
<Filter>include\beast\http\impl</Filter>
|
||||||
</None>
|
</None>
|
||||||
@@ -687,6 +687,9 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\http\parser.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\parser.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\http\parse_error.hpp">
|
||||||
|
<Filter>include\beast\http</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\read.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\read.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -699,21 +702,30 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\http\rfc2616.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\rfc2616.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\http\rfc7230.hpp">
|
||||||
|
<Filter>include\beast\http</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\streambuf_body.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\streambuf_body.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\string_body.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\string_body.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\type_check.hpp">
|
|
||||||
<Filter>include\beast\http</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\http\write.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\http\write.hpp">
|
||||||
<Filter>include\beast\http</Filter>
|
<Filter>include\beast\http</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<None Include="..\..\src\beast\include\beast\impl\basic_streambuf.ipp">
|
<None Include="..\..\src\beast\include\beast\impl\basic_streambuf.ipp">
|
||||||
<Filter>include\beast\impl</Filter>
|
<Filter>include\beast\impl</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\consuming_buffers.ipp">
|
||||||
|
<Filter>include\beast\impl</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\prepare_buffers.ipp">
|
||||||
|
<Filter>include\beast\impl</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="..\..\src\beast\include\beast\impl\static_streambuf.ipp">
|
||||||
|
<Filter>include\beast\impl</Filter>
|
||||||
|
</None>
|
||||||
<None Include="..\..\src\beast\include\beast\impl\streambuf_readstream.ipp">
|
<None Include="..\..\src\beast\include\beast\impl\streambuf_readstream.ipp">
|
||||||
<Filter>include\beast\impl</Filter>
|
<Filter>include\beast\impl</Filter>
|
||||||
</None>
|
</None>
|
||||||
@@ -741,6 +753,9 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\decorator.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\decorator.hpp">
|
||||||
<Filter>include\beast\websocket\detail</Filter>
|
<Filter>include\beast\websocket\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\endian.hpp">
|
||||||
|
<Filter>include\beast\websocket\detail</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\error.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\detail\error.hpp">
|
||||||
<Filter>include\beast\websocket\detail</Filter>
|
<Filter>include\beast\websocket\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -819,12 +834,21 @@
|
|||||||
<ClInclude Include="..\..\src\beast\include\beast\websocket\teardown.hpp">
|
<ClInclude Include="..\..\src\beast\include\beast\websocket\teardown.hpp">
|
||||||
<Filter>include\beast\websocket</Filter>
|
<Filter>include\beast\websocket</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\src\beast_http_nodejs_parser.cpp">
|
<ClInclude Include="..\..\src\beast\include\beast\write_streambuf.hpp">
|
||||||
<Filter>src</Filter>
|
<Filter>include\beast</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\beast\test\http\nodejs-parser\http_parser.c">
|
||||||
|
<Filter>test\http\nodejs-parser</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\beast\src\http-parser\http_parser.c">
|
<ClInclude Include="..\..\src\beast\test\http\nodejs-parser\http_parser.h">
|
||||||
<Filter>src\http-parser</Filter>
|
<Filter>test\http\nodejs-parser</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\beast\test\http\nodejs_parser.cpp">
|
||||||
|
<Filter>test\http</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\..\src\beast\test\http\nodejs_parser.hpp">
|
||||||
|
<Filter>test\http</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-32bit.h">
|
<ClInclude Include="..\..\src\ed25519-donna\curve25519-donna-32bit.h">
|
||||||
<Filter>ed25519-donna</Filter>
|
<Filter>ed25519-donna</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ for tu_style in ['classic', 'unity']:
|
|||||||
cc_flags = {}
|
cc_flags = {}
|
||||||
|
|
||||||
object_builder.add_source_files(
|
object_builder.add_source_files(
|
||||||
'src/beast/src/beast_http_nodejs_parser.cpp',
|
'src/beast/test/http/nodejs_parser.cpp',
|
||||||
'src/ripple/beast/unity/beast_hash_unity.cpp',
|
'src/ripple/beast/unity/beast_hash_unity.cpp',
|
||||||
'src/ripple/unity/beast.cpp',
|
'src/ripple/unity/beast.cpp',
|
||||||
'src/ripple/unity/lz4.c',
|
'src/ripple/unity/lz4.c',
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
#include <beast/http/method.hpp>
|
#include <beast/http/method.hpp>
|
||||||
#include <beast/http/headers.hpp>
|
#include <beast/http/headers.hpp>
|
||||||
#include <beast/http/basic_parser.hpp>
|
#include <beast/http/basic_parser.hpp>
|
||||||
#include <beast/http/detail/writes.hpp>
|
#include <beast/http/rfc2616.hpp>
|
||||||
|
#include <beast/write_streambuf.hpp>
|
||||||
|
#include <beast/test/http/nodejs_parser.hpp>
|
||||||
#include <beast/detail/ci_char_traits.hpp>
|
#include <beast/detail/ci_char_traits.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <boost/asio/streambuf.hpp>
|
#include <boost/asio/streambuf.hpp>
|
||||||
@@ -340,39 +342,39 @@ write (Streambuf& stream, message const& m)
|
|||||||
{
|
{
|
||||||
if (m.request())
|
if (m.request())
|
||||||
{
|
{
|
||||||
http::detail::write (stream, to_string(m.method()));
|
beast::write (stream, to_string(m.method()));
|
||||||
http::detail::write (stream, " ");
|
beast::write (stream, " ");
|
||||||
http::detail::write (stream, m.url());
|
beast::write (stream, m.url());
|
||||||
http::detail::write (stream, " HTTP/");
|
beast::write (stream, " HTTP/");
|
||||||
http::detail::write (stream, std::to_string(m.version().first));
|
beast::write (stream, std::to_string(m.version().first));
|
||||||
http::detail::write (stream, ".");
|
beast::write (stream, ".");
|
||||||
http::detail::write (stream, std::to_string(m.version().second));
|
beast::write (stream, std::to_string(m.version().second));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
http::detail::write (stream, "HTTP/");
|
beast::write (stream, "HTTP/");
|
||||||
http::detail::write (stream, std::to_string(m.version().first));
|
beast::write (stream, std::to_string(m.version().first));
|
||||||
http::detail::write (stream, ".");
|
beast::write (stream, ".");
|
||||||
http::detail::write (stream, std::to_string(m.version().second));
|
beast::write (stream, std::to_string(m.version().second));
|
||||||
http::detail::write (stream, " ");
|
beast::write (stream, " ");
|
||||||
http::detail::write (stream, std::to_string(m.status()));
|
beast::write (stream, std::to_string(m.status()));
|
||||||
http::detail::write (stream, " ");
|
beast::write (stream, " ");
|
||||||
http::detail::write (stream, m.reason());
|
beast::write (stream, m.reason());
|
||||||
}
|
}
|
||||||
http::detail::write (stream, "\r\n");
|
beast::write (stream, "\r\n");
|
||||||
write_fields(stream, m.headers);
|
write_fields(stream, m.headers);
|
||||||
http::detail::write (stream, "\r\n");
|
beast::write (stream, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class parser
|
class parser
|
||||||
: public beast::http::basic_parser<parser>
|
: public beast::http::nodejs_basic_parser<parser>
|
||||||
{
|
{
|
||||||
// friend class basic_parser<parser>;
|
|
||||||
|
|
||||||
message& m_;
|
message& m_;
|
||||||
std::function<void(void const*, std::size_t)> write_body_;
|
std::function<void(void const*, std::size_t)> write_body_;
|
||||||
|
std::string field_;
|
||||||
|
std::string value_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parser(parser&&) = default;
|
parser(parser&&) = default;
|
||||||
@@ -388,7 +390,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
parser(std::function<void(void const*, std::size_t)> write_body,
|
parser(std::function<void(void const*, std::size_t)> write_body,
|
||||||
message& m, bool request)
|
message& m, bool request)
|
||||||
: basic_parser(request)
|
: nodejs_basic_parser(request)
|
||||||
, m_(m)
|
, m_(m)
|
||||||
, write_body_(std::move(write_body))
|
, write_body_(std::move(write_body))
|
||||||
{
|
{
|
||||||
@@ -396,7 +398,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
parser(message& m, body& b, bool request)
|
parser(message& m, body& b, bool request)
|
||||||
: basic_parser(request)
|
: nodejs_basic_parser(request)
|
||||||
, m_(m)
|
, m_(m)
|
||||||
{
|
{
|
||||||
write_body_ = [&b](void const* data, std::size_t size)
|
write_body_ = [&b](void const* data, std::size_t size)
|
||||||
@@ -407,6 +409,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
|
|
||||||
|
void flush()
|
||||||
|
{
|
||||||
|
if(! value_.empty())
|
||||||
|
{
|
||||||
|
rfc2616::trim_right_in_place(value_);
|
||||||
|
// VFALCO could std::move
|
||||||
|
m_.headers.insert(field_, value_);
|
||||||
|
field_.clear();
|
||||||
|
value_.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_start()
|
on_start()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <ripple/overlay/impl/PeerImp.h>
|
#include <ripple/overlay/impl/PeerImp.h>
|
||||||
#include <ripple/overlay/impl/Tuning.h>
|
#include <ripple/overlay/impl/Tuning.h>
|
||||||
#include <ripple/json/json_reader.h>
|
#include <ripple/json/json_reader.h>
|
||||||
|
#include <beast/http/write.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -218,48 +219,32 @@ ConnectAttempt::onHandshake (error_code ec)
|
|||||||
if (! sharedValue)
|
if (! sharedValue)
|
||||||
return close(); // makeSharedValue logs
|
return close(); // makeSharedValue logs
|
||||||
|
|
||||||
beast::deprecated_http::message req = makeRequest(
|
req_ = makeRequest(! overlay_.peerFinder().config().peerPrivate,
|
||||||
! overlay_.peerFinder().config().peerPrivate,
|
|
||||||
remote_endpoint_.address());
|
remote_endpoint_.address());
|
||||||
auto const hello = buildHello (
|
auto const hello = buildHello (
|
||||||
*sharedValue,
|
*sharedValue,
|
||||||
overlay_.setup().public_ip,
|
overlay_.setup().public_ip,
|
||||||
beast::IPAddressConversion::from_asio(remote_endpoint_),
|
beast::IPAddressConversion::from_asio(remote_endpoint_),
|
||||||
app_);
|
app_);
|
||||||
appendHello (req.headers, hello);
|
appendHello (req_.headers, hello);
|
||||||
|
|
||||||
beast::deprecated_http::write (write_buf_, req);
|
|
||||||
|
|
||||||
setTimer();
|
setTimer();
|
||||||
stream_.async_write_some (write_buf_.data(),
|
beast::http::async_write(stream_, req_,
|
||||||
strand_.wrap (std::bind (&ConnectAttempt::onWrite,
|
strand_.wrap (std::bind (&ConnectAttempt::onWrite,
|
||||||
shared_from_this(), beast::asio::placeholders::error,
|
shared_from_this(), beast::asio::placeholders::error)));
|
||||||
beast::asio::placeholders::bytes_transferred)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectAttempt::onWrite (error_code ec, std::size_t bytes_transferred)
|
ConnectAttempt::onWrite (error_code ec)
|
||||||
{
|
{
|
||||||
cancelTimer();
|
cancelTimer();
|
||||||
|
|
||||||
if(! stream_.next_layer().is_open())
|
if(! stream_.next_layer().is_open())
|
||||||
return;
|
return;
|
||||||
if(ec == boost::asio::error::operation_aborted)
|
if(ec == boost::asio::error::operation_aborted)
|
||||||
return;
|
return;
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("onWrite", ec);
|
return fail("onWrite", ec);
|
||||||
JLOG(journal_.trace()) <<
|
onRead(error_code(), 0);
|
||||||
"onWrite: " << bytes_transferred << " bytes";
|
|
||||||
|
|
||||||
write_buf_.consume (bytes_transferred);
|
|
||||||
if (write_buf_.size() == 0)
|
|
||||||
return onRead (error_code(), 0);
|
|
||||||
|
|
||||||
setTimer();
|
|
||||||
stream_.async_write_some (write_buf_.data(),
|
|
||||||
strand_.wrap (std::bind (&ConnectAttempt::onWrite,
|
|
||||||
shared_from_this(), beast::asio::placeholders::error,
|
|
||||||
beast::asio::placeholders::bytes_transferred)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -330,14 +315,15 @@ ConnectAttempt::onShutdown (error_code ec)
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
beast::deprecated_http::message
|
auto
|
||||||
ConnectAttempt::makeRequest (bool crawl,
|
ConnectAttempt::makeRequest (bool crawl,
|
||||||
boost::asio::ip::address const& remote_address)
|
boost::asio::ip::address const& remote_address) ->
|
||||||
|
request_type
|
||||||
{
|
{
|
||||||
beast::deprecated_http::message m;
|
request_type m;
|
||||||
m.method (beast::http::method_t::http_get);
|
m.method = beast::http::method_t::http_get;
|
||||||
m.url ("/");
|
m.url = "/";
|
||||||
m.version (1, 1);
|
m.version = 11;
|
||||||
m.headers.insert ("User-Agent", BuildInfo::getFullVersionString());
|
m.headers.insert ("User-Agent", BuildInfo::getFullVersionString());
|
||||||
m.headers.insert ("Upgrade", "RTXP/1.2");
|
m.headers.insert ("Upgrade", "RTXP/1.2");
|
||||||
//std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol()));
|
//std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol()));
|
||||||
|
|||||||
@@ -28,13 +28,14 @@
|
|||||||
#include <ripple/overlay/Message.h>
|
#include <ripple/overlay/Message.h>
|
||||||
#include <ripple/protocol/BuildInfo.h>
|
#include <ripple/protocol/BuildInfo.h>
|
||||||
#include <ripple/protocol/UintTypes.h>
|
#include <ripple/protocol/UintTypes.h>
|
||||||
#include <beast/placeholders.hpp>
|
|
||||||
#include <ripple/beast/asio/ssl_bundle.h>
|
#include <ripple/beast/asio/ssl_bundle.h>
|
||||||
#include <beast/streambuf.hpp>
|
|
||||||
#include <beast/http/message.hpp>
|
|
||||||
#include <beast/http/parser.hpp>
|
|
||||||
#include <ripple/beast/net/IPAddressConversion.h>
|
#include <ripple/beast/net/IPAddressConversion.h>
|
||||||
#include <ripple/beast/utility/WrappedSink.h>
|
#include <ripple/beast/utility/WrappedSink.h>
|
||||||
|
#include <beast/placeholders.hpp>
|
||||||
|
#include <beast/streambuf.hpp>
|
||||||
|
#include <beast/http/message.hpp>
|
||||||
|
#include <beast/http/empty_body.hpp>
|
||||||
|
#include <beast/http/parser.hpp>
|
||||||
#include <boost/asio/basic_waitable_timer.hpp>
|
#include <boost/asio/basic_waitable_timer.hpp>
|
||||||
#include <boost/asio/buffers_iterator.hpp>
|
#include <boost/asio/buffers_iterator.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
@@ -51,8 +52,12 @@ class ConnectAttempt
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using error_code = boost::system::error_code;
|
using error_code = boost::system::error_code;
|
||||||
|
|
||||||
using endpoint_type = boost::asio::ip::tcp::endpoint;
|
using endpoint_type = boost::asio::ip::tcp::endpoint;
|
||||||
|
|
||||||
|
using request_type =
|
||||||
|
beast::http::request<beast::http::empty_body>;
|
||||||
|
|
||||||
Application& app_;
|
Application& app_;
|
||||||
std::uint32_t const id_;
|
std::uint32_t const id_;
|
||||||
beast::WrappedSink sink_;
|
beast::WrappedSink sink_;
|
||||||
@@ -70,6 +75,7 @@ private:
|
|||||||
beast::streambuf body_;
|
beast::streambuf body_;
|
||||||
beast::deprecated_http::parser parser_;
|
beast::deprecated_http::parser parser_;
|
||||||
PeerFinder::Slot::ptr slot_;
|
PeerFinder::Slot::ptr slot_;
|
||||||
|
request_type req_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectAttempt (Application& app, boost::asio::io_service& io_service,
|
ConnectAttempt (Application& app, boost::asio::io_service& io_service,
|
||||||
@@ -87,6 +93,7 @@ public:
|
|||||||
run();
|
run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
void fail (std::string const& reason);
|
void fail (std::string const& reason);
|
||||||
void fail (std::string const& name, error_code ec);
|
void fail (std::string const& name, error_code ec);
|
||||||
@@ -95,12 +102,12 @@ private:
|
|||||||
void onTimer (error_code ec);
|
void onTimer (error_code ec);
|
||||||
void onConnect (error_code ec);
|
void onConnect (error_code ec);
|
||||||
void onHandshake (error_code ec);
|
void onHandshake (error_code ec);
|
||||||
void onWrite (error_code ec, std::size_t bytes_transferred);
|
void onWrite (error_code ec);
|
||||||
void onRead (error_code ec, std::size_t bytes_transferred);
|
void onRead (error_code ec, std::size_t bytes_transferred);
|
||||||
void onShutdown (error_code ec);
|
void onShutdown (error_code ec);
|
||||||
|
|
||||||
static
|
static
|
||||||
beast::deprecated_http::message
|
request_type
|
||||||
makeRequest (bool crawl,
|
makeRequest (bool crawl,
|
||||||
boost::asio::ip::address const& remote_address);
|
boost::asio::ip::address const& remote_address);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RIPPLE_SERVER_HANDOFF_H_INCLUDED
|
#define RIPPLE_SERVER_HANDOFF_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/server/Writer.h>
|
#include <ripple/server/Writer.h>
|
||||||
|
#include <ripple/beast/deprecated_http.h>
|
||||||
#include <beast/http/message.hpp>
|
#include <beast/http/message.hpp>
|
||||||
#include <beast/http/streambuf_body.hpp>
|
#include <beast/http/streambuf_body.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -30,6 +31,9 @@ namespace ripple {
|
|||||||
using http_request_type =
|
using http_request_type =
|
||||||
beast::http::request<beast::http::streambuf_body>;
|
beast::http::request<beast::http::streambuf_body>;
|
||||||
|
|
||||||
|
using http_response_type =
|
||||||
|
beast::deprecated_http::message;
|
||||||
|
|
||||||
/** Used to indicate the result of a server connection handoff. */
|
/** Used to indicate the result of a server connection handoff. */
|
||||||
struct Handoff
|
struct Handoff
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ make_JsonWriter (beast::deprecated_http::message& m, Json::Value const& json)
|
|||||||
m.headers.insert("Content-Length", std::to_string(body.size()));
|
m.headers.insert("Content-Length", std::to_string(body.size()));
|
||||||
m.headers.erase ("Content-Type");
|
m.headers.erase ("Content-Type");
|
||||||
m.headers.insert("Content-Type", "application/json");
|
m.headers.insert("Content-Type", "application/json");
|
||||||
write(prebody, m);
|
beast::deprecated_http::write(prebody, m);
|
||||||
return std::make_shared<streambufs_writer>(
|
return std::make_shared<streambufs_writer>(
|
||||||
std::move(prebody), std::move(body));
|
std::move(prebody), std::move(body));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,6 @@ public:
|
|||||||
virtual
|
virtual
|
||||||
Setup const&
|
Setup const&
|
||||||
setup() const = 0;
|
setup() const = 0;
|
||||||
|
|
||||||
/** Fills in boilerplate HTTP header field values. */
|
|
||||||
static
|
|
||||||
void
|
|
||||||
appendStandardFields (beast::deprecated_http::message& message);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <ripple/server/Writer.h>
|
#include <ripple/server/Writer.h>
|
||||||
#include <ripple/beast/deprecated_http.h>
|
#include <ripple/beast/deprecated_http.h>
|
||||||
#include <beast/streambuf.hpp>
|
#include <beast/streambuf.hpp>
|
||||||
|
#include <beast/write_streambuf.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -96,8 +97,8 @@ private:
|
|||||||
message_.headers.erase("Content-Length");
|
message_.headers.erase("Content-Length");
|
||||||
message_.headers.insert("Content-Length",
|
message_.headers.insert("Content-Length",
|
||||||
std::to_string(body_.size()));
|
std::to_string(body_.size()));
|
||||||
write(streambuf_, message_);
|
beast::deprecated_http::write(streambuf_, message_);
|
||||||
beast::http::detail::write(streambuf_, body_);
|
beast::write(streambuf_, body_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -687,13 +687,6 @@ ServerHandlerImp::authorized (Port const& port,
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void
|
|
||||||
ServerHandler::appendStandardFields (beast::deprecated_http::message& message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerHandler::Setup::makeContexts()
|
ServerHandler::Setup::makeContexts()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,11 @@
|
|||||||
#include <ripple/json/json_reader.h>
|
#include <ripple/json/json_reader.h>
|
||||||
#include <ripple/json/to_string.h>
|
#include <ripple/json/to_string.h>
|
||||||
#include <ripple/server/Port.h>
|
#include <ripple/server/Port.h>
|
||||||
#include <beast/streambuf.hpp>
|
#include <beast/http/message.hpp>
|
||||||
#include <beast/http/parser.hpp>
|
#include <beast/http/streambuf_body.hpp>
|
||||||
|
#include <beast/http/string_body.hpp>
|
||||||
|
#include <beast/http/read.hpp>
|
||||||
|
#include <beast/http/write.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -69,17 +72,19 @@ class JSONRPCClient : public AbstractClient
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::asio::ip::tcp::endpoint ep_;
|
||||||
boost::asio::io_service ios_;
|
boost::asio::io_service ios_;
|
||||||
boost::asio::ip::tcp::socket stream_;
|
boost::asio::ip::tcp::socket stream_;
|
||||||
boost::asio::streambuf bin_;
|
beast::streambuf bin_;
|
||||||
beast::streambuf bout_;
|
beast::streambuf bout_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
JSONRPCClient(Config const& cfg)
|
JSONRPCClient(Config const& cfg)
|
||||||
: stream_(ios_)
|
: ep_(getEndpoint(cfg))
|
||||||
|
, stream_(ios_)
|
||||||
{
|
{
|
||||||
stream_.connect(getEndpoint(cfg));
|
stream_.connect(ep_);
|
||||||
}
|
}
|
||||||
|
|
||||||
~JSONRPCClient() override
|
~JSONRPCClient() override
|
||||||
@@ -98,7 +103,17 @@ public:
|
|||||||
invoke(std::string const& cmd,
|
invoke(std::string const& cmd,
|
||||||
Json::Value const& params) override
|
Json::Value const& params) override
|
||||||
{
|
{
|
||||||
std::string s;
|
using namespace beast::http;
|
||||||
|
using namespace boost::asio;
|
||||||
|
using namespace std::string_literals;
|
||||||
|
|
||||||
|
request<string_body> req;
|
||||||
|
req.method = method_t::http_post;
|
||||||
|
req.url = "/";
|
||||||
|
req.version = 11;
|
||||||
|
req.headers.insert("Content-Type", "application/json; charset=UTF-8");
|
||||||
|
req.headers.insert("Host",
|
||||||
|
ep_.address().to_string() + ":" + std::to_string(ep_.port()));
|
||||||
{
|
{
|
||||||
Json::Value jr;
|
Json::Value jr;
|
||||||
jr["method"] = cmd;
|
jr["method"] = cmd;
|
||||||
@@ -107,47 +122,16 @@ public:
|
|||||||
Json::Value& ja = jr["params"] = Json::arrayValue;
|
Json::Value& ja = jr["params"] = Json::arrayValue;
|
||||||
ja.append(params);
|
ja.append(params);
|
||||||
}
|
}
|
||||||
s = to_string(jr);
|
req.body = to_string(jr);
|
||||||
}
|
}
|
||||||
|
write(stream_, req);
|
||||||
|
|
||||||
using namespace boost::asio;
|
response<streambuf_body> res;
|
||||||
using namespace std::string_literals;
|
read(stream_, bin_, res);
|
||||||
auto const r =
|
|
||||||
"POST / HTTP/1.1\r\n"
|
|
||||||
"Host: me\r\n"
|
|
||||||
"Connection: Keep-Alive\r\n"s +
|
|
||||||
"Content-Type: application/json; charset=UTF-8\r\n"s +
|
|
||||||
"Content-Length: " + std::to_string(s.size()) + "\r\n"
|
|
||||||
"\r\n" + s;
|
|
||||||
write(stream_, buffer(r));
|
|
||||||
|
|
||||||
read_until(stream_, bin_, "\r\n\r\n");
|
|
||||||
beast::streambuf body;
|
|
||||||
beast::deprecated_http::message m;
|
|
||||||
beast::deprecated_http::parser p(
|
|
||||||
[&](void const* data, std::size_t size)
|
|
||||||
{
|
|
||||||
body.commit(buffer_copy(
|
|
||||||
body.prepare(size), const_buffer(data, size)));
|
|
||||||
}, m, false);
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
boost::system::error_code ec;
|
|
||||||
auto used = p.write(bin_.data(), ec);
|
|
||||||
if(ec)
|
|
||||||
Throw<boost::system::system_error>(ec);
|
|
||||||
bin_.consume(used);
|
|
||||||
// VFALCO What do we do if bin_ still has data?
|
|
||||||
if(p.complete())
|
|
||||||
break;
|
|
||||||
bin_.commit(stream_.read_some(
|
|
||||||
bin_.prepare(1024)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::Reader jr;
|
Json::Reader jr;
|
||||||
Json::Value jv;
|
Json::Value jv;
|
||||||
jr.parse(buffer_string(body.data()), jv);
|
jr.parse(buffer_string(res.body.data()), jv);
|
||||||
if(jv["result"].isMember("error"))
|
if(jv["result"].isMember("error"))
|
||||||
jv["error"] = jv["result"]["error"];
|
jv["error"] = jv["result"]["error"];
|
||||||
if(jv["result"].isMember("status"))
|
if(jv["result"].isMember("status"))
|
||||||
|
|||||||
Reference in New Issue
Block a user