diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-02-26 20:58:07 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-03-05 16:23:34 +0000 |
commit | 9bf017edf200cdb39e576b28d0263223a5afcaf9 (patch) | |
tree | 12fa99daa3d3a9f4876d7192930915ee9e6458c7 /contrib/epee/include/net/http_client.h | |
parent | http_client: allow derived class to get headers at start (diff) | |
download | monero-9bf017edf200cdb39e576b28d0263223a5afcaf9.tar.xz |
http_client: allow cancelling a download
Diffstat (limited to 'contrib/epee/include/net/http_client.h')
-rw-r--r-- | contrib/epee/include/net/http_client.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h index 1e497074f..67e63f7bf 100644 --- a/contrib/epee/include/net/http_client.h +++ b/contrib/epee/include/net/http_client.h @@ -538,7 +538,11 @@ using namespace std; } CHECK_AND_ASSERT_MES(m_len_in_remain >= recv_buff.size(), false, "m_len_in_remain >= recv_buff.size()"); m_len_in_remain -= recv_buff.size(); - m_pcontent_encoding_handler->update_in(recv_buff); + if (!m_pcontent_encoding_handler->update_in(recv_buff)) + { + m_state = reciev_machine_state_done; + return false; + } if(m_len_in_remain == 0) m_state = reciev_machine_state_done; @@ -711,7 +715,11 @@ using namespace std; m_len_in_remain = 0; } - m_pcontent_encoding_handler->update_in(chunk_body); + if (!m_pcontent_encoding_handler->update_in(chunk_body)) + { + m_state = reciev_machine_state_error; + return false; + } if(!m_len_in_remain) m_chunked_state = http_chunked_state_chunk_head; |