mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Changes for Beast version 59
This commit is contained in:
committed by
Miguel Portilla
parent
49bdf2e72d
commit
61316c7f95
@@ -25,7 +25,6 @@
|
||||
#include <test/jtx/WSClient.h>
|
||||
#include <test/jtx/JSONRPCClient.h>
|
||||
#include <ripple/core/DeadlineTimer.h>
|
||||
#include <beast/core/to_string.hpp>
|
||||
#include <beast/http.hpp>
|
||||
#include <beast/test/yield_to.hpp>
|
||||
#include <beast/websocket/detail/mask.hpp>
|
||||
@@ -86,17 +85,18 @@ class ServerStatus_test :
|
||||
using namespace beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.url = "/";
|
||||
req.target("/");
|
||||
req.version = 11;
|
||||
req.fields.insert("Host", host + ":" + to_string(port));
|
||||
req.fields.insert("User-Agent", "test");
|
||||
req.method = "GET";
|
||||
req.fields.insert("Upgrade", "websocket");
|
||||
req.insert("Host", host + ":" + to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
req.method(beast::http::verb::get);
|
||||
req.insert("Upgrade", "websocket");
|
||||
beast::websocket::detail::maskgen maskgen;
|
||||
std::string key = beast::websocket::detail::make_sec_ws_key(maskgen);
|
||||
req.fields.insert("Sec-WebSocket-Key", key);
|
||||
req.fields.insert("Sec-WebSocket-Version", "13");
|
||||
prepare(req, connection::upgrade);
|
||||
beast::websocket::detail::sec_ws_key_type key;
|
||||
beast::websocket::detail::make_sec_ws_key(key, maskgen);
|
||||
req.insert("Sec-WebSocket-Key", key);
|
||||
req.insert("Sec-WebSocket-Version", "13");
|
||||
req.insert(beast::http::field::connection, "upgrade");
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -109,21 +109,21 @@ class ServerStatus_test :
|
||||
using namespace beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.url = "/";
|
||||
req.target("/");
|
||||
req.version = 11;
|
||||
req.fields.insert("Host", host + ":" + to_string(port));
|
||||
req.fields.insert("User-Agent", "test");
|
||||
req.insert("Host", host + ":" + to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
if(body.empty())
|
||||
{
|
||||
req.method = "GET";
|
||||
req.method(beast::http::verb::get);
|
||||
}
|
||||
else
|
||||
{
|
||||
req.method = "POST";
|
||||
req.fields.insert("Content-Type", "application/json; charset=UTF-8");
|
||||
req.method(beast::http::verb::post);
|
||||
req.insert("Content-Type", "application/json; charset=UTF-8");
|
||||
req.body = body;
|
||||
}
|
||||
prepare(req);
|
||||
req.prepare();
|
||||
|
||||
return req;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class ServerStatus_test :
|
||||
using namespace beast::http;
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
beast::streambuf sb;
|
||||
beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
@@ -287,7 +287,7 @@ class ServerStatus_test :
|
||||
doWSRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.status == 401);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
}
|
||||
|
||||
//secure request
|
||||
@@ -297,7 +297,7 @@ class ServerStatus_test :
|
||||
doWSRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.status == 401);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ class ServerStatus_test :
|
||||
doHTTPRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.status == 200);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
}
|
||||
|
||||
//secure request
|
||||
@@ -330,7 +330,7 @@ class ServerStatus_test :
|
||||
doHTTPRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.status == 200);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -362,7 +362,7 @@ class ServerStatus_test :
|
||||
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
beast::streambuf sb;
|
||||
beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
|
||||
Reference in New Issue
Block a user