nghttp, nghttpd: Clean up around NGHTTP2_DATA_FLAG_NO_END_STREAM

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-08 16:28:23 +09:00
parent c4b487be05
commit d10dc4bb9b
2 changed files with 10 additions and 4 deletions

View File

@ -832,7 +832,6 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
auto config = hd->get_config();
if (!config->trailer.empty()) {
*data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
std::vector<nghttp2_nv> nva;
nva.reserve(config->trailer.size());
for (auto &kv : config->trailer) {
@ -840,7 +839,11 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
}
rv = nghttp2_submit_trailer(session, stream_id, nva.data(), nva.size());
if (rv != 0) {
*data_flags &= ~NGHTTP2_DATA_FLAG_NO_END_STREAM;
if (nghttp2_is_fatal(rv)) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
} else {
*data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
}
}

View File

@ -2128,7 +2128,6 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
if (nread == 0) {
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
if (!config.trailer.empty()) {
*data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
std::vector<nghttp2_nv> nva;
nva.reserve(config.trailer.size());
for (auto &kv : config.trailer) {
@ -2136,7 +2135,11 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
}
rv = nghttp2_submit_trailer(session, stream_id, nva.data(), nva.size());
if (rv != 0) {
*data_flags &= ~NGHTTP2_DATA_FLAG_NO_END_STREAM;
if (nghttp2_is_fatal(rv)) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
} else {
*data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
}
}
} else {