Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix request buffering for HTTP/2.0 #10204

Merged
merged 9 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ RUN apt-get install -y \
unzip \
git \
m4 \
libyaml-dev
libyaml-dev \
libcurl4-openssl-dev
2 changes: 2 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ services:
KONG_PG_HOST: db
OPENSSL_DIR: /usr/local/kong
CRYPTO_DIR: /usr/local/kong
# env vars to be able to run tests
KONG_TEST_PG_DATABASE: kong

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Install packages
if: steps.cache-deps.outputs.cache-hit != 'true'
run: sudo apt update && sudo apt install libyaml-dev valgrind libprotobuf-dev
run: sudo apt update && sudo apt install libyaml-dev valgrind libprotobuf-dev libcurl4-openssl-dev

- name: Build Kong
if: steps.cache-deps.outputs.cache-hit != 'true'
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OS := $(shell uname | awk '{print tolower($$0)}')
MACHINE := $(shell uname -m)

DEV_ROCKS = "busted 2.1.2" "busted-htest 1.0.0" "luacheck 1.1.0" "lua-llthreads2 0.1.6" "http 0.4" "ldoc 1.4.6"
DEV_ROCKS = "busted 2.1.2" "busted-htest 1.0.0" "luacheck 1.1.0" "lua-llthreads2 0.1.6" "http 0.4" "ldoc 1.4.6" "Lua-cURL 0.3.13"
WIN_SCRIPTS = "bin/busted" "bin/kong" "bin/kong-health"
BUSTED_ARGS ?= -v
TEST_CMD ?= bin/busted $(BUSTED_ARGS)
Expand All @@ -12,10 +12,12 @@ ifeq ($(OS), darwin)
OPENSSL_DIR ?= $(shell brew --prefix)/opt/openssl
GRPCURL_OS ?= osx
YAML_DIR ?= $(shell brew --prefix)/opt/libyaml
CURL_INCDIR ?= $(shell brew --prefix)/opt/curl/include
else
OPENSSL_DIR ?= /usr
GRPCURL_OS ?= $(OS)
YAML_DIR ?= /usr
CURL_INCDIR ?= /usr/include/x86_64-linux-gnu/
hanshuebner marked this conversation as resolved.
Show resolved Hide resolved
endif

ifeq ($(MACHINE), aarch64)
Expand Down Expand Up @@ -77,7 +79,7 @@ install-dev-rocks: build-venv
else \
echo $$rock not found, installing via luarocks... ; \
LIBRARY_PREFIX=$$(pwd)/bazel-bin/build/$(BUILD_NAME)/kong ; \
luarocks install $$rock OPENSSL_DIR=$$LIBRARY_PREFIX CRYPTO_DIR=$$LIBRARY_PREFIX YAML_DIR=$(YAML_DIR) || exit 1; \
luarocks install $$rock OPENSSL_DIR=$$LIBRARY_PREFIX CRYPTO_DIR=$$LIBRARY_PREFIX YAML_DIR=$(YAML_DIR) CURL_INCDIR=$(CURL_INCDIR) || exit 1; \
fi \
done;

Expand Down
19 changes: 9 additions & 10 deletions kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1280,19 +1280,18 @@ return {
return exec("@grpc")
end

if protocol_version == 1.1 then
if route.request_buffering == false then
if route.response_buffering == false then
return exec("@unbuffered")
end

return exec("@unbuffered_request")
end

if route.request_buffering == false then
if route.response_buffering == false then
return exec("@unbuffered_response")
return exec("@unbuffered")
end

return exec("@unbuffered_request")
end

if route.response_buffering == false then
return exec("@unbuffered_response")
end

end
end,
-- Only executed if the `router` module found a route and allows nginx to proxy it.
Expand Down
Loading