aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-26 11:59:42 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-03-05 16:23:29 +0000
commit0d90123cac012a824120dbd2ac3e06209f039ab3 (patch)
tree5a8cfa11de9ace5ed2e75500538a1cd60c79caaa /contrib
parentMerge pull request #1844 (diff)
downloadmonero-0d90123cac012a824120dbd2ac3e06209f039ab3.tar.xz
http_client: allow derived class to get headers at start
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/net/http_client.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h
index d73eda39c..1e497074f 100644
--- a/contrib/epee/include/net/http_client.h
+++ b/contrib/epee/include/net/http_client.h
@@ -337,6 +337,11 @@ using namespace std;
return true;
}
//---------------------------------------------------------------------------
+ virtual bool on_header(const http_response_info &headers)
+ {
+ return true;
+ }
+ //---------------------------------------------------------------------------
inline
bool invoke_get(const boost::string_ref uri, std::chrono::milliseconds timeout, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
{
@@ -505,6 +510,12 @@ using namespace std;
m_header_cache.erase(m_header_cache.begin()+pos+4, m_header_cache.end());
analize_cached_header_and_invoke_state();
+ if (!on_header(m_response_info))
+ {
+ MDEBUG("Connection cancelled by on_header");
+ m_state = reciev_machine_state_done;
+ return false;
+ }
m_header_cache.clear();
if(!recv_buff.size() && (m_state != reciev_machine_state_error && m_state != reciev_machine_state_done))
need_more_data = true;