mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
http_protocol_handler: speedup newline discarding
This commit is contained in:
parent
6a58c88e2d
commit
885a117ddb
1 changed files with 5 additions and 2 deletions
|
@ -236,6 +236,8 @@ namespace net_utils
|
||||||
bool simple_http_connection_handler<t_connection_context>::handle_buff_in(std::string& buf)
|
bool simple_http_connection_handler<t_connection_context>::handle_buff_in(std::string& buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
size_t ndel;
|
||||||
|
|
||||||
if(m_cache.size())
|
if(m_cache.size())
|
||||||
m_cache += buf;
|
m_cache += buf;
|
||||||
else
|
else
|
||||||
|
@ -253,11 +255,12 @@ namespace net_utils
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//check_and_handle_fake_response();
|
//check_and_handle_fake_response();
|
||||||
if((m_cache[0] == '\r' || m_cache[0] == '\n'))
|
ndel = m_cache.find_first_not_of("\r\n");
|
||||||
|
if (ndel != 0)
|
||||||
{
|
{
|
||||||
//some times it could be that before query line cold be few line breaks
|
//some times it could be that before query line cold be few line breaks
|
||||||
//so we have to be calm without panic with assers
|
//so we have to be calm without panic with assers
|
||||||
m_cache.erase(0, 1);
|
m_cache.erase(0, ndel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue