diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-26 19:33:39 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-26 20:18:33 +0100 |
commit | 885a117ddb5370056c38534f1586f377cf5cd37b (patch) | |
tree | e674c628c7ec6d8841a303e8b6d5dffc79de700e /contrib/epee/include/net/http_protocol_handler.inl | |
parent | console_handler: fix start_default_console use of prompt parameter (diff) | |
download | monero-885a117ddb5370056c38534f1586f377cf5cd37b.tar.xz |
http_protocol_handler: speedup newline discarding
Diffstat (limited to 'contrib/epee/include/net/http_protocol_handler.inl')
-rw-r--r-- | contrib/epee/include/net/http_protocol_handler.inl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/epee/include/net/http_protocol_handler.inl b/contrib/epee/include/net/http_protocol_handler.inl index c18f7f706..7aba6c1dd 100644 --- a/contrib/epee/include/net/http_protocol_handler.inl +++ b/contrib/epee/include/net/http_protocol_handler.inl @@ -236,6 +236,8 @@ namespace net_utils bool simple_http_connection_handler<t_connection_context>::handle_buff_in(std::string& buf) { + size_t ndel; + if(m_cache.size()) m_cache += buf; else @@ -253,11 +255,12 @@ namespace net_utils break; //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 //so we have to be calm without panic with assers - m_cache.erase(0, 1); + m_cache.erase(0, ndel); break; } |