nghttpx: Various test failures

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-04 02:46:35 +09:00
parent c86e839091
commit 9e685a2734
3 changed files with 14 additions and 2 deletions

View File

@ -927,6 +927,10 @@ int Http2Upstream::downstream_read(DownstreamConnection *dconn) {
if (rv == SHRPX_ERR_EOF) { if (rv == SHRPX_ERR_EOF) {
return downstream_eof(dconn); return downstream_eof(dconn);
} }
if (rv == SHRPX_ERR_DCONN_CANCELED) {
downstream->pop_downstream_connection();
return 0;
}
if (rv != 0) { if (rv != 0) {
if (rv != SHRPX_ERR_NETWORK) { if (rv != SHRPX_ERR_NETWORK) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
@ -1163,8 +1167,10 @@ int Http2Upstream::send_reply(Downstream *downstream, const uint8_t *body,
auto status_code_str = util::utos(downstream->get_response_http_status()); auto status_code_str = util::utos(downstream->get_response_http_status());
auto &headers = downstream->get_response_headers(); auto &headers = downstream->get_response_headers();
auto nva = std::vector<nghttp2_nv>();
// 2 for :status and server // 2 for :status and server
auto nva = std::vector<nghttp2_nv>(2 + headers.size()); nva.reserve(2 + headers.size());
nva.push_back(http2::make_nv_ls(":status", status_code_str)); nva.push_back(http2::make_nv_ls(":status", status_code_str));
for (auto &kv : headers) { for (auto &kv : headers) {

View File

@ -800,6 +800,7 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body,
auto status_str = auto status_str =
http2::get_status_string(downstream->get_response_http_status()); http2::get_status_string(downstream->get_response_http_status());
output->append(status_str.c_str(), status_str.size()); output->append(status_str.c_str(), status_str.size());
output->append("\r\n");
for (auto &kv : downstream->get_response_headers()) { for (auto &kv : downstream->get_response_headers()) {
if (kv.name.empty() || kv.name[0] == ':') { if (kv.name.empty() || kv.name[0] == ':') {

View File

@ -600,6 +600,10 @@ int SpdyUpstream::downstream_read(DownstreamConnection *dconn) {
if (rv == SHRPX_ERR_EOF) { if (rv == SHRPX_ERR_EOF) {
return downstream_eof(dconn); return downstream_eof(dconn);
} }
if (rv == SHRPX_ERR_DCONN_CANCELED) {
downstream->pop_downstream_connection();
return 0;
}
if (rv != 0) { if (rv != 0) {
if (rv != SHRPX_ERR_NETWORK) { if (rv != SHRPX_ERR_NETWORK) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
@ -815,8 +819,9 @@ int SpdyUpstream::send_reply(Downstream *downstream, const uint8_t *body,
auto &headers = downstream->get_response_headers(); auto &headers = downstream->get_response_headers();
auto nva = std::vector<const char *>();
// 3 for :status, :version and server // 3 for :status, :version and server
auto nva = std::vector<const char *>(3 + headers.size()); nva.reserve(3 + headers.size());
nva.push_back(":status"); nva.push_back(":status");
nva.push_back(status_string.c_str()); nva.push_back(status_string.c_str());