diff --git a/.github/actions/setup-caddy/action.yml b/.github/actions/setup-caddy/action.yml new file mode 100644 index 0000000000000..8c3969bd28248 --- /dev/null +++ b/.github/actions/setup-caddy/action.yml @@ -0,0 +1,10 @@ +name: Setup Caddy server +runs: + using: composite + steps: + - shell: bash + run: | + set -x + sudo curl 'https://caddyserver.com/api/download?os=linux&arch=amd64' -o /usr/bin/caddy + sudo chmod +x /usr/bin/caddy + sudo caddy start --config ext/curl/tests/Caddyfile diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4e92d3ebdb5f8..f61340486f189 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -42,6 +42,8 @@ jobs: uses: ./.github/actions/setup-mssql - name: Create Oracle container uses: ./.github/actions/setup-oracle + - name: Setup Caddy server + uses: ./.github/actions/setup-caddy - name: apt uses: ./.github/actions/apt-x64 - name: ccache diff --git a/ext/curl/tests/Caddyfile b/ext/curl/tests/Caddyfile new file mode 100644 index 0000000000000..28deb40926fc0 --- /dev/null +++ b/ext/curl/tests/Caddyfile @@ -0,0 +1,13 @@ +{ + admin off + auto_https disable_redirects +} + +localhost + +respond / "Caddy is up and running" + +# HTTP/2 Server Push +respond /serverpush "main response" +respond /serverpush/pushed "pushed response" +push /serverpush /serverpush/pushed diff --git a/ext/curl/tests/bug76675.phpt b/ext/curl/tests/bug76675.phpt index 02cdfe4d5710f..af624f462a69d 100644 --- a/ext/curl/tests/bug76675.phpt +++ b/ext/curl/tests/bug76675.phpt @@ -2,18 +2,14 @@ Bug #76675 (Segfault with H2 server push write/writeheader handlers) --EXTENSIONS-- curl ---XFAIL-- -http2.golang.org/serverpush is gone --SKIPIF-- --FILE-- --FILE-- curl, CURLOPT_HEADER, false); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, false); curl_setopt($this->curl, CURLOPT_FAILONERROR, false); - curl_setopt($this->curl, CURLOPT_URL, 'https://http2.golang.org/serverpush'); + curl_setopt($this->curl, CURLOPT_URL, 'https://localhost/serverpush'); curl_setopt($this->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, function ($ch, $data) { return \strlen($data); diff --git a/ext/curl/tests/curl_pushfunction.phpt b/ext/curl/tests/curl_pushfunction.phpt new file mode 100644 index 0000000000000..3b43dee4e25c6 --- /dev/null +++ b/ext/curl/tests/curl_pushfunction.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test CURLMOPT_PUSHFUNCTION +--CREDITS-- +Davey Shafik +Kévin Dunglas +--EXTENSIONS-- +curl +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Array +( + [0] => main response + [1] => pushed response +) diff --git a/ext/curl/tests/skipif-nocaddy.inc b/ext/curl/tests/skipif-nocaddy.inc new file mode 100644 index 0000000000000..21a06c12af106 --- /dev/null +++ b/ext/curl/tests/skipif-nocaddy.inc @@ -0,0 +1,12 @@ +