nghttpx: Fix the issue that forwarded h3 GET request always has chunked TE

This commit is contained in:
Tatsuhiro Tsujikawa 2022-01-23 19:28:07 +09:00
parent 02a5649343
commit 2275327794
4 changed files with 13 additions and 8 deletions

View File

@ -114,8 +114,9 @@ jobs:
- name: Build nghttp3
if: matrix.http3 == 'http3'
run: |
git clone --depth 1 -b v0.1.1 https://github.com/ngtcp2/nghttp3
git clone https://github.com/ngtcp2/nghttp3
cd nghttp3
git checkout 207318c92e0578ac393c31dcd797e4a4dca3e31a
autoreconf -i
./configure --prefix=$PWD/build --enable-lib-only
make -j$(nproc) check

View File

@ -366,8 +366,9 @@ Build nghttp3:
.. code-block:: text
$ git clone --depth 1 -b v0.1.1 https://github.com/ngtcp2/nghttp3
$ git clone https://github.com/ngtcp2/nghttp3
$ cd nghttp3
$ git checkout 207318c92e0578ac393c31dcd797e4a4dca3e31a
$ autoreconf -i
$ ./configure --prefix=$PWD/build --enable-lib-only
$ make -j$(nproc)

View File

@ -1998,7 +1998,7 @@ int Http3Upstream::http_recv_request_header(Downstream *downstream,
}
namespace {
int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id,
int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id, int fin,
void *user_data, void *stream_user_data) {
auto upstream = static_cast<Http3Upstream *>(user_data);
auto handler = upstream->get_client_handler();
@ -2008,7 +2008,7 @@ int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id,
return 0;
}
if (upstream->http_end_request_headers(downstream) != 0) {
if (upstream->http_end_request_headers(downstream, fin) != 0) {
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
@ -2019,7 +2019,7 @@ int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id,
}
} // namespace
int Http3Upstream::http_end_request_headers(Downstream *downstream) {
int Http3Upstream::http_end_request_headers(Downstream *downstream, int fin) {
auto lgconf = log_config();
lgconf->update_tstamp(std::chrono::system_clock::now());
auto &req = downstream->request();
@ -2115,8 +2115,11 @@ int Http3Upstream::http_end_request_headers(Downstream *downstream) {
req.connect_proto = ConnectProto::WEBSOCKET;
}
// We are not sure that request has body or not at the moment.
req.http2_expect_body = true;
if (!fin) {
req.http2_expect_body = true;
} else if (req.fs.content_length == -1) {
req.fs.content_length = 0;
}
downstream->inspect_http2_request();

View File

@ -125,7 +125,7 @@ public:
int http_recv_request_header(Downstream *downstream, int32_t token,
nghttp3_rcbuf *name, nghttp3_rcbuf *value,
uint8_t flags);
int http_end_request_headers(Downstream *downstream);
int http_end_request_headers(Downstream *downstream, int fin);
int http_end_stream(Downstream *downstream);
void start_downstream(Downstream *downstream);
void initiate_downstream(Downstream *downstream);