Reset error codes

fix #478
This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:20 -07:00
1 parent 7d92048c5c
commit ca109693fb
32 files changed
+276 -67

No files matched your search

+1
View File
@@ -122,6 +122,7 @@ public:
relay<true>(upstream.client, downstream.server, buffer, ec,
[&](header<true, fields>& h, error_code& ec)
{
ec = {};
h.erase("Content-Length");
h.replace("Transfer-Encoding", "chunked");
});
+4
View File
@@ -212,6 +212,7 @@ print_cxx14(message<isRequest, Body, Fields> const& m)
sr.get(ec,
[&sr](error_code& ec, auto const& buffer)
{
ec = {};
std::cout << buffers(buffer);
sr.consume(boost::asio::buffer_size(buffer));
});
@@ -238,6 +239,7 @@ struct lambda
template<class ConstBufferSequence>
void operator()(error_code& ec, ConstBufferSequence const& buffer) const
{
ec = {};
std::cout << buffers(buffer);
sr.consume(boost::asio::buffer_size(buffer));
}
@@ -278,6 +280,7 @@ split_print_cxx14(message<isRequest, Body, Fields> const& m)
sr.get(ec,
[&sr](error_code& ec, auto const& buffer)
{
ec = {};
std::cout << buffers(buffer);
sr.consume(boost::asio::buffer_size(buffer));
});
@@ -291,6 +294,7 @@ split_print_cxx14(message<isRequest, Body, Fields> const& m)
sr.get(ec,
[&sr](error_code& ec, auto const& buffer)
{
ec = {};
std::cout << buffers(buffer);
sr.consume(boost::asio::buffer_size(buffer));
});
+14 -6
View File
@@ -166,50 +166,58 @@ public:
void
on_request(verb, string_view,
string_view, int, error_code&)
string_view, int, error_code& ec)
{
ec = {};
}
void
on_response(int,
string_view,
int, error_code&)
int, error_code& ec)
{
ec = {};
}
void
on_field(field,
string_view, string_view, error_code&)
string_view, string_view, error_code& ec)
{
ec = {};
}
void
on_header(error_code& ec)
{
ec = {};
}
void
on_body(boost::optional<std::uint64_t> const&,
error_code&)
error_code& ec)
{
ec = {};
}
void
on_data(string_view,
error_code& ec)
{
ec = {};
}
void
on_chunk(std::uint64_t,
string_view,
error_code&)
error_code& ec)
{
ec = {};
}
void
on_complete(error_code&)
on_complete(error_code& ec)
{
ec = {};
}
};
+16
View File
@@ -58,6 +58,8 @@ public:
got_on_begin = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -72,6 +74,8 @@ public:
got_on_begin = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -81,6 +85,8 @@ public:
got_on_field = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -89,6 +95,8 @@ public:
got_on_header = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -101,6 +109,8 @@ public:
static_cast<bool>(content_length_);
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -110,6 +120,8 @@ public:
body.append(s.data(), s.size());
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -119,6 +131,8 @@ public:
got_on_chunk = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
void
@@ -127,6 +141,8 @@ public:
got_on_complete = true;
if(fc_)
fc_->fail(ec);
else
ec = {};
}
};
+12 -6
View File
@@ -55,20 +55,23 @@ public:
}
void
init(error_code&)
init(error_code& ec)
{
ec = {};
}
boost::optional<std::pair<const_buffers_type, bool>>
get(error_code&)
get(error_code& ec)
{
ec = {};
return {{const_buffers_type{
body_.data(), body_.size()}, false}};
}
void
finish(error_code&)
finish(error_code& ec)
{
ec = {};
}
};
};
@@ -107,13 +110,15 @@ public:
}
void
init(error_code&)
init(error_code& ec)
{
ec = {};
}
boost::optional<std::pair<const_buffers_type, bool>>
get(error_code&)
get(error_code& ec)
{
ec = {};
body_.read = true;
return get(
std::integral_constant<bool, isSplit>{},
@@ -121,8 +126,9 @@ public:
}
void
finish(error_code&)
finish(error_code& ec)
{
ec = {};
}
private: