mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Some cleanups.
This commit is contained in:
@@ -50,7 +50,6 @@ HTTPRequestAction HTTPRequest::consume(boost::asio::streambuf& buf)
|
||||
bShouldClose = sRequest.find("HTTP/1.1") == std::string::npos;
|
||||
|
||||
eState = await_header;
|
||||
// cLog(lsTRACE) << "Got first line. Going to header state";
|
||||
return haREAD_LINE;
|
||||
}
|
||||
|
||||
@@ -60,11 +59,10 @@ HTTPRequestAction HTTPRequest::consume(boost::asio::streambuf& buf)
|
||||
{
|
||||
if (iDataSize == 0)
|
||||
{ // no body
|
||||
eState = bShouldClose ? await_close : await_reset;
|
||||
eState = do_request;
|
||||
return haDO_REQUEST;
|
||||
}
|
||||
eState = getting_body;
|
||||
// cLog(lsTRACE) << "Got header, need body: " << iDataSize;
|
||||
return haREAD_RAW;
|
||||
}
|
||||
vHeaders.push_back(line);
|
||||
|
||||
@@ -24,8 +24,7 @@ protected:
|
||||
await_request, // We are waiting for the request line
|
||||
await_header, // We are waiting for request headers
|
||||
getting_body, // We are waiting for the body
|
||||
await_close, // We are waiting for the request to complete so we can close the connection
|
||||
await_reset // We are waiting for the request to complete so we can reset the connection
|
||||
do_request, // We are waiting for the request to complete
|
||||
};
|
||||
|
||||
state eState;
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
#ifndef RPC_MAXIMUM_QUERY
|
||||
#define RPC_MAXIMUM_QUERY (1024*1024)
|
||||
#endif
|
||||
|
||||
RPCServer::RPCServer(boost::asio::io_service& io_service , NetworkOPs* nopNetwork)
|
||||
: mNetOps(nopNetwork), mSocket(io_service)
|
||||
{
|
||||
@@ -152,7 +156,13 @@ void RPCServer::handle_read_line(const boost::system::error_code& e)
|
||||
else if (action == haREAD_RAW)
|
||||
{
|
||||
int rLen = mHTTPRequest.getDataSize();
|
||||
assert(rLen > 0);
|
||||
if ((rLen < 0) || (rLen > RPC_MAXIMUM_QUERY))
|
||||
{
|
||||
cLog(lsWARNING) << "Illegal RPC request length " << rLen;
|
||||
boost::system::error_code ignore_ec;
|
||||
mSocket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignore_ec);
|
||||
return;
|
||||
}
|
||||
|
||||
int alreadyHave = mLineBuffer.size();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user