From: Michael Wallner Date: Tue, 7 Sep 2021 07:45:02 +0000 (+0200) Subject: Merge branch 'curl-matrix': fix #116 X-Git-Tag: v4.2.1~1 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=f3b5b84017131e5354aacaa01836d317dad38686;hp=c05c9593fc7b7a0025e78517671cc0c5759bed4b Merge branch 'curl-matrix': fix #116 --- diff --git a/.github/workflows/curl-matrix.yml b/.github/workflows/curl-matrix.yml new file mode 100644 index 0000000..3544bda --- /dev/null +++ b/.github/workflows/curl-matrix.yml @@ -0,0 +1,993 @@ +# generated file; do not edit! + +name: curl-matrix +on: + workflow_dispatch: + push: + +jobs: + curl-master: + name: curl-master + continue-on-error: true + env: + PHP: "8.0" + CURL: "master" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_78_0: + name: curl-7_78_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_78_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_78_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_77_0: + name: curl-7_77_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_77_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_77_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_76_1: + name: curl-7_76_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_76_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_76_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_74_0: + name: curl-7_74_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_74_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_74_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_71_1: + name: curl-7_71_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_71_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_71_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_68_0: + name: curl-7_68_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_68_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_68_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_67_0: + name: curl-7_67_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_67_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_67_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_64_0: + name: curl-7_64_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_64_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_64_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_61_1: + name: curl-7_61_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_61_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_61_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_58_0: + name: curl-7_58_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_58_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_58_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_52_1: + name: curl-7_52_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_52_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_52_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_49_1: + name: curl-7_49_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_49_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_49_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_31_0: + name: curl-7_31_0 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_31_0" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_31_0 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_20_1: + name: curl-7_20_1 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_20_1" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_20_1 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_19_7: + name: curl-7_19_7 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_19_7" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_19_7 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + + curl-7_18_2: + name: curl-7_18_2 + continue-on-error: true + env: + PHP: "8.0" + CURL: "7_18_2" + enable_debug: "yes" + enable_iconv: "yes" + with_http_libcurl_dir: "/opt" + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + ref: curl-7_18_2 # + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + diff --git a/autoconf/pecl/libbrotli.m4 b/autoconf/pecl/libbrotli.m4 index f8916e2..575f635 100644 --- a/autoconf/pecl/libbrotli.m4 +++ b/autoconf/pecl/libbrotli.m4 @@ -1,5 +1,11 @@ AC_DEFUN([PECL_CHECK_LIBBROTLI], [ + dnl config.m4 calls PECL_CHECK_DONE once more + PECL_COUNT_CHECKS([+1]) + PECL_SAVE_ENV([CPPFLAGS], [libbrotli]) + PECL_SAVE_ENV([LDFLAGS], [libbrotli]) + PECL_SAVE_ENV([LIBS], [libbrotli]) + PECL_CHECK_LIBBROTLI_COMMON([$1], [$2]) PECL_CHECK_DONE(libbrotlicommon, [$PECL_VAR([HAVE_LIBBROTLI_COMMON])]) PECL_CHECK_LIBBROTLI_DEC([$1], [$2]) diff --git a/autoconf/pecl/libcurl.m4 b/autoconf/pecl/libcurl.m4 index 4d99207..8de9499 100644 --- a/autoconf/pecl/libcurl.m4 +++ b/autoconf/pecl/libcurl.m4 @@ -160,6 +160,48 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl fi fi ]) + + PECL_HAVE_CONST([curl/curl.h], [CURL_LOCK_DATA_SSL_SESSION], int, [ + AC_CACHE_CHECK([whether curl_share accepts CURL_LOCK_DATA_SSL_SESSION], PECL_CACHE_VAR([LIBCURL_SHARE_SSL]), [ + PECL_CACHE_VAR([LIBCURL_SHARE_SSL])= + AC_TRY_RUN([ + #include + int main(int argc, char *argv[]) { + CURLSH *ch = curl_share_init(); + return curl_share_setopt(ch, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); + } + ], [ + PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=yes + ], [ + PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=no + ]) + ]) + if test "$PECL_CACHE_VAR([LIBCURL_SHARE_SSL])" = yes; then + PECL_DEFINE([HAVE_LIBCURL_SHARE_SSL], [1]) + fi + ]) + + if test "$PECL_VAR([LIBCURL_SSLLIB])" == "OpenSSL"; then + PECL_HAVE_CONST([curl/curl.h], [CURLOPT_TLS13_CIPHERS], int, [ + AC_CACHE_CHECK([whether curl_easy_setopt accepts CURLOPT_TLS13_CIPHERS], PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS]), [ + PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])= + AC_TRY_RUN([ + #include + int main(int argc, char *argv[]) { + CURL *ch = curl_easy_init(); + return curl_easy_setopt(ch, CURLSHOPT_TLS13_CIPHERS, ""); + } + ], [ + PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])=yes + ], [ + PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])=no + ]) + ]) + if test "$PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])" = yes; then + PECL_DEFINE([HAVE_LIBCURL_TLS13_CIPHERS], [1]) + fi + ]) + fi ]) ]) dnl diff --git a/autoconf/pecl/pecl.m4 b/autoconf/pecl/pecl.m4 index ffa45ac..d8735b0 100644 --- a/autoconf/pecl/pecl.m4 +++ b/autoconf/pecl/pecl.m4 @@ -70,6 +70,12 @@ AC_DEFUN([PECL_RESTORE_ENV], [ $1=$PECL_SAVE_VAR([$2_$1]) ]) dnl +dnl PECL_COUNT_CHECKS(incdec) +dnl +AC_DEFUN([PECL_COUNT_CHECKS], [ + PECL_VAR([_checks])=$(($PECL_VAR([_checks])$1)) +]) +dnl dnl PECL_EVAL_LIBLINE(libline) dnl AC_DEFUN([PECL_EVAL_LIBLINE], [ @@ -244,6 +250,7 @@ dnl dnl PECL_CHECK_CUSTOM(name, path, header, lib, version) dnl AC_DEFUN([PECL_CHECK_CUSTOM], [ + PECL_COUNT_CHECKS([+1]) PECL_SAVE_ENV([CPPFLAGS], [$1]) PECL_SAVE_ENV([LDFLAGS], [$1]) PECL_SAVE_ENV([LIBS], [$1]) @@ -260,10 +267,10 @@ AC_DEFUN([PECL_CHECK_CUSTOM], [ done ]) if test -n "$PECL_CACHE_VAR([$1_prefix])"; then - CPPFLAGS="-I$PECL_CACHE_VAR([$1_prefix])/include" - LDFLAGS="-L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR" - LIBS="-l$4" - PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) + CPPFLAGS="$CPPFLAGS -I$PECL_CACHE_VAR([$1_prefix])/include" + LDFLAGS="$LDFLAGS -L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR" + LIBS="$LIBS -l$4" + dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) AC_CACHE_VAL(PECL_CACHE_VAR([$1_version]), [ pushd $PECL_CACHE_VAR([$1_prefix]) >/dev/null @@ -288,11 +295,11 @@ dnl dnl PECL_CHECK_CONFIG(name, prog-config, version-flag, cppflags-flag, ldflags-flag, libs-flag) dnl AC_DEFUN([PECL_CHECK_CONFIG], [ + PECL_COUNT_CHECKS([+1]) PECL_SAVE_ENV([CPPFLAGS], [$1]) PECL_SAVE_ENV([LDFLAGS], [$1]) PECL_SAVE_ENV([LIBS], [$1]) - AC_MSG_CHECKING([for $1]) ifelse($2, [$PKG_CONFIG $1], [ AC_CACHE_VAL(PECL_CACHE_VAR([$1_exists]), [ @@ -311,20 +318,22 @@ AC_DEFUN([PECL_CHECK_CONFIG], [ AC_CACHE_VAL(PECL_CACHE_VAR([$1_cppflags]), [ PECL_CACHE_VAR([$1_cppflags])=$($2 $4) ]) - CPPFLAGS=$PECL_CACHE_VAR([$1_cppflags]) + CPPFLAGS="$CPPFLAGS $PECL_CACHE_VAR([$1_cppflags])" AC_CACHE_VAL(PECL_CACHE_VAR([$1_ldflags]), [ PECL_CACHE_VAR([$1_ldflags])=$($2 $5) ]) - LDFLAGS=$PECL_CACHE_VAR([$1_ldflags]) + LDFLAGS="$LDFLAGS $PECL_CACHE_VAR([$1_ldflags])" AC_CACHE_VAL(PECL_CACHE_VAR([$1_libs]), [ PECL_CACHE_VAR([$1_libs])=$($2 $6) ]) - LIBS=$PECL_CACHE_VAR([$1_libs]) - PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) + LIBS="$LIBS $PECL_CACHE_VAR([$1_libs])" + dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) ifelse($2, [$PKG_CONFIG $1], [ fi ]) + AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}]) + if test -n "$PECL_CHECKED_VERSION([$1])"; then PECL_VAR([HAVE_$1])=true PECL_DEFINE([HAVE_$1]) @@ -332,8 +341,6 @@ AC_DEFUN([PECL_CHECK_CONFIG], [ else PECL_VAR([HAVE_$1])=false fi - - AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}]) ]) dnl dnl PECL_CHECK_PKGCONFIG(pkg[, additional-pkg-config-path]) @@ -355,9 +362,25 @@ dnl dnl PECL_CHECK_DONE(name, success[, incline, libline]) dnl AC_DEFUN([PECL_CHECK_DONE], [ - if $2; then - incline=$CPPFLAGS - libline="$LDFLAGS $LIBS" + PECL_COUNT_CHECKS([-1]) + success=$2 + if $success && test -n "$LDFLAGS$LIBS"; then + AC_MSG_CHECKING([whether $1 can be linked]) + AC_TRY_LINK([], [], [success=yes], [success=no]) + AC_MSG_RESULT([$success]) + if ! $success; then + AC_MSG_WARN([$1 was found, but fails to link with:]) + AC_MSG_WARN([ LDFLAGS='$LDFLAGS']) + AC_MSG_WARN([ LIBS='$LIBS']) + AC_MSG_WARN([Missing or updated library paths?]) + fi + fi + if $success; then + _cppflags=$PECL_SAVE_VAR([$1_CPPFLAGS]) + _ldflags=$PECL_SAVE_VAR([$1_LDFLAGS]) + _libs=$PECL_SAVE_VAR([$1_LIBS]) + incline=${CPPFLAGS:${#_cppflags}} + libline=["${LDFLAGS:${#_ldflags}} ${LIBS:${#_libs}}"] PECL_DEFINE([HAVE_$1]) else incline=$3 diff --git a/config9.m4 b/config9.m4 index ef7d33e..695701b 100644 --- a/config9.m4 +++ b/config9.m4 @@ -24,6 +24,8 @@ if test "$PHP_HTTP" != "no"; then AC_CHECK_LIB(nsl, getdomainname) ]) AC_CHECK_FUNCS(mbrtowc mbtowc iswalnum inet_pton) + + CFLAGS="$CFLAGS -Wno-strict-prototypes" dnl ZLIB PHP_ARG_WITH([http-zlib-dir], [whether/where to check for zlib], diff --git a/scripts/curlver.dist b/scripts/curlver.dist new file mode 100644 index 0000000..b0d22b4 --- /dev/null +++ b/scripts/curlver.dist @@ -0,0 +1,16 @@ +# current is 7.78.0 ATM +# 7.21.5-7.29.0 fail to configure on gh actions + +alpine: 7.78.0 7.67.0 +centos: 7.61.1 # 7.29.0 +debian: 7.74.0 7.64.0 7.52.1 +fedora: 7.78.0 7.76.1 7.71.1 +other: 7.49.1 7.31.0 +ubuntu: 7.74.0 7.68.0 7.58.0 + +# always test against a few recent +latest: master 7.78.0 7.77.0 7.76.1 +oldest: 7.18.2 7.19.7 7.20.1 + +# 7.64.1 fails client tests because of superfluous infof() calls +# 7.64.0 fails client cookie test because of curl/curl#3613 diff --git a/scripts/gen_github_workflow_curl-matrix.php b/scripts/gen_github_workflow_curl-matrix.php new file mode 100755 index 0000000..66b50c9 --- /dev/null +++ b/scripts/gen_github_workflow_curl-matrix.php @@ -0,0 +1,104 @@ +#!/usr/bin/env php + + +name: curl-matrix +on: + workflow_dispatch: + push: + +jobs: + 1) { + $curlver = array_map(fn($v) => strtr($v, ".", "_"), array_unique(array_slice($argv, 1))); +} else { + $curlver = array_unique( + iterator_to_array( + (function() { + $split = function($sep, $subject, $def = [""]) { + return array_filter(array_map("trim", explode($sep, $subject))) + $def; + }; + foreach (file(__DIR__."/curlver.dist") as $line) { + $rec = $split(":", $split("#", $line)[0]); + if (!empty($rec[1])) foreach ($split(" ", $rec[1], []) as $dist_ver) { + yield strtr($dist_ver, ".", "_"); + } + } + })() + ) + ); +} + +rsort($curlver, SORT_NATURAL); + +$gen = include __DIR__ . "/ci/gen-matrix.php"; +$job = $gen->github([ +"curl" => [ + "PHP" => "8.0", + "CURL" => $curlver, + "enable_debug" => "yes", + "enable_iconv" => "yes", + "with_http_libcurl_dir" => "/opt", +]]); +foreach ($job as $id => $env) { + printf(" curl-%s:\n", $env["CURL"]); + printf(" name: curl-%s\n", $env["CURL"]); + printf(" continue-on-error: true\n"); + printf(" env:\n"); + foreach ($env as $key => $val) { + printf(" %s: \"%s\"\n", $key, $val); + } +?> + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + path: http + - uses: actions/checkout@v2 + with: + repository: curl/curl + path: curl + + ref: curl- # + + - name: Install + run: | + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ + echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ + sudo apt-get update -y && \ + sudo apt-get build-dep -y libcurl4-openssl-dev && \ + sudo apt-get install -y \ + php-cli \ + php-pear \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Curl + run: | + sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh + sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool + cd curl + ./buildconf + ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 + make -j2 + make install + - name: Prepare + run: | + cd http + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + - name: Build + run: | + cd http + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + cd http + make -f scripts/ci/Makefile test + +ops->dequeue) { + php_http_client_enqueue_t *enqueue = php_http_client_enqueued(h, request, NULL); + + if (!enqueue) { + php_error_docref(NULL, E_WARNING, "Failed to requeue request; request not in queue"); + return FAILURE; + } + return h->ops->requeue(h, enqueue); + } + return FAILURE; +} + php_http_client_enqueue_t *php_http_client_enqueued(php_http_client_t *h, void *compare_arg, php_http_client_enqueue_cmp_func_t compare_func) { zend_llist_element *el = NULL; @@ -632,9 +646,8 @@ static PHP_METHOD(HttpClient, reset) RETVAL_ZVAL(getThis(), 1, 0); } -static HashTable *combined_options(zval *client, zval *request) +static HashTable *combined_options(HashTable *options, zval *client, zval *request) { - HashTable *options; unsigned num_options = 0; zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, Z_OBJ_P(client), ZEND_STRL("options"), 0, &z_options_tmp); @@ -649,8 +662,12 @@ static HashTable *combined_options(zval *client, zval *request) num_options = num; } } - ALLOC_HASHTABLE(options); - ZEND_INIT_SYMTABLE_EX(options, num_options, 0); + if (options) { + zend_hash_clean(options); + } else { + ALLOC_HASHTABLE(options); + ZEND_INIT_SYMTABLE_EX(options, num_options, 0); + } if (Z_TYPE_P(z_coptions) == IS_ARRAY) { array_copy(Z_ARRVAL_P(z_coptions), options); } @@ -713,7 +730,7 @@ static PHP_METHOD(HttpClient, enqueue) Z_ADDREF_P(request); q.request = msg_obj->message; - q.options = combined_options(getThis(), request); + q.options = combined_options(NULL, getThis(), request); q.dtor = msg_queue_dtor; q.opaque = msg_obj; q.closure.fci = fci; @@ -769,19 +786,33 @@ static PHP_METHOD(HttpClient, requeue) zend_fcall_info_cache fcc = empty_fcall_info_cache; php_http_client_object_t *obj; php_http_message_object_t *msg_obj; - php_http_client_enqueue_t q; + php_http_client_enqueue_t q, *e; php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O|f", &request, php_http_get_client_request_class_entry(), &fci, &fcc), invalid_arg, return); obj = PHP_HTTP_OBJ(NULL, getThis()); msg_obj = PHP_HTTP_OBJ(NULL, request); - if (php_http_client_enqueued(obj->client, msg_obj->message, NULL)) { - php_http_expect(SUCCESS == php_http_client_dequeue(obj->client, msg_obj->message), runtime, return); + if ((e = php_http_client_enqueued(obj->client, msg_obj->message, NULL))) { + combined_options(e->options, getThis(), request); + php_http_expect(SUCCESS == php_http_client_requeue(obj->client, msg_obj->message), runtime, return); + if (fci.size) { + if (e->closure.fci.size) { + zval_ptr_dtor(&e->closure.fci.function_name); + if (e->closure.fci.object) { + zend_object_release(e->closure.fci.object); + } + } + Z_TRY_ADDREF(fci.function_name); + if (fci.object) { + GC_ADDREF(fci.object); + } + } + RETURN_ZVAL(getThis(), 1, 0); } q.request = msg_obj->message; - q.options = combined_options(getThis(), request); + q.options = combined_options(NULL, getThis(), request); q.dtor = msg_queue_dtor; q.opaque = msg_obj; q.closure.fci = fci; diff --git a/src/php_http_client.h b/src/php_http_client.h index fd77204..da53b4d 100644 --- a/src/php_http_client.h +++ b/src/php_http_client.h @@ -47,6 +47,7 @@ typedef int (*php_http_client_once_func_t)(struct php_http_client *p); typedef ZEND_RESULT_CODE (*php_http_client_wait_func_t)(struct php_http_client *p, struct timeval *custom_timeout); typedef ZEND_RESULT_CODE (*php_http_client_enqueue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); typedef ZEND_RESULT_CODE (*php_http_client_dequeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); +typedef ZEND_RESULT_CODE (*php_http_client_requeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); typedef ZEND_RESULT_CODE (*php_http_client_setopt_func_t)(struct php_http_client *p, php_http_client_setopt_opt_t opt, void *arg); typedef ZEND_RESULT_CODE (*php_http_client_getopt_func_t)(struct php_http_client *h, php_http_client_getopt_opt_t opt, void *arg, void **res); @@ -61,6 +62,7 @@ typedef struct php_http_client_ops { php_http_client_once_func_t once; php_http_client_enqueue_func_t enqueue; php_http_client_dequeue_func_t dequeue; + php_http_client_requeue_func_t requeue; php_http_client_setopt_func_t setopt; php_http_client_getopt_func_t getopt; } php_http_client_ops_t; diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c index 0e79f19..daadf69 100644 --- a/src/php_http_client_curl.c +++ b/src/php_http_client_curl.c @@ -17,6 +17,8 @@ #if PHP_HTTP_HAVE_LIBCURL +#define DEBUG_COOKIES 0 + #if PHP_HTTP_HAVE_LIBCURL_OPENSSL # include #endif @@ -834,6 +836,9 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiesession(php_http_option_ return FAILURE; } if (Z_TYPE_P(val) == IS_TRUE) { +#if DEBUG_COOKIES + fprintf(stderr, "CURLOPT_COOKIELIST: SESS\n"); +#endif if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIELIST, "SESS")) { return FAILURE; } @@ -856,9 +861,19 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t } else { storage->cookiestore = NULL; } - if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "") - || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore) - ) { + +#if DEBUG_COOKIES + fprintf(stderr, "CURLOPT_COOKIEFILE: %s\n", storage->cookiestore); +#endif + // does NOT enable ch->data.cookies until transfer; adds to ch->stsate.cookielist + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "")) { + return FAILURE; + } +#if DEBUG_COOKIES + fprintf(stderr, "CURLOPT_COOKIEJAR: %s\n", storage->cookiestore); +#endif + // enables ch->data.cookies + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)) { return FAILURE; } @@ -1587,7 +1602,7 @@ static void php_http_curle_options_init(php_http_options_t *registry) opt->flags |= PHP_HTTP_CURLE_OPTION_IGNORE_RC; } #endif -#if PHP_HTTP_CURL_VERSION(7,61,0) +#if PHP_HTTP_CURL_VERSION(7,61,0) && PHP_HTTP_HAVE_LIBCURL_TLS13_CIPHERS if ((opt = php_http_option_register(ssl_registry, ZEND_STRL("tls13_ciphers"), CURLOPT_TLS13_CIPHERS, IS_STRING))) { opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN; } @@ -1676,7 +1691,7 @@ static void php_http_curle_options_init(php_http_options_t *registry) opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR; } # endif -# if PHP_HTTP_CURL_VERSION(7,61,0) +# if PHP_HTTP_CURL_VERSION(7,61,0) && PHP_HTTP_HAVE_LIBCURL_TLS13_CIPHERS if ((opt = php_http_option_register(proxy_registry, ZEND_STRL("tls13_ciphers"), CURLOPT_PROXY_TLS13_CIPHERS, IS_STRING))) { opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN; } @@ -1919,7 +1934,7 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_share_cookies(php_http_option_ return SUCCESS; } -#if PHP_HTTP_CURL_VERSION(7,23,0) +#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL static ZEND_RESULT_CODE php_http_curlm_option_set_share_ssl(php_http_option_t *opt, zval *value, void *userdata) { php_http_client_t *client = userdata; @@ -1994,7 +2009,7 @@ static void php_http_curlm_options_init(php_http_options_t *registry) opt->setter = php_http_curlm_option_set_share_cookies; ZVAL_TRUE(&opt->defval); } -#if PHP_HTTP_CURL_VERSION(7,23,0) +#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL if ((opt = php_http_option_register(registry, ZEND_STRL("share_ssl"), 0, _IS_BOOL))) { opt->setter = php_http_curlm_option_set_share_ssl; ZVAL_TRUE(&opt->defval); @@ -2052,9 +2067,10 @@ static ZEND_RESULT_CODE php_http_curlm_set_option(php_http_option_t *opt, zval * /* client ops */ -static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_handler_t *curl) +static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_handler_t *handler) { - CURL *ch = curl->handle; + php_http_client_curl_t *curl = handler->client->ctx; + CURL *ch = handler->handle; php_http_curle_storage_t *st; if ((st = php_http_curle_get_storage(ch))) { @@ -2083,27 +2099,61 @@ static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_ #endif #if PHP_HTTP_CURL_VERSION(7,21,3) - if (curl->options.resolve) { - curl_slist_free_all(curl->options.resolve); - curl->options.resolve = NULL; + if (handler->options.resolve) { + curl_slist_free_all(handler->options.resolve); + handler->options.resolve = NULL; } #endif - curl->options.retry.count = 0; - curl->options.retry.delay = 0; - curl->options.redirects = 0; - curl->options.encode_cookies = 1; + handler->options.retry.count = 0; + handler->options.retry.delay = 0; + handler->options.redirects = 0; + handler->options.encode_cookies = 1; - if (curl->options.headers) { - curl_slist_free_all(curl->options.headers); - curl->options.headers = NULL; + if (handler->options.headers) { + curl_slist_free_all(handler->options.headers); + handler->options.headers = NULL; } - if (curl->options.proxyheaders) { - curl_slist_free_all(curl->options.proxyheaders); - curl->options.proxyheaders = NULL; + if (handler->options.proxyheaders) { + curl_slist_free_all(handler->options.proxyheaders); + handler->options.proxyheaders = NULL; } - php_http_buffer_reset(&curl->options.cookies); - php_http_buffer_reset(&curl->options.ranges); + php_http_buffer_reset(&handler->options.cookies); + php_http_buffer_reset(&handler->options.ranges); + + if (php_http_message_body_size(handler->response.body)) { + php_http_message_body_free(&handler->response.body); + handler->response.body = php_http_message_body_init(NULL, NULL); + } + php_http_buffer_reset(&handler->response.headers); + +#if ZTS + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); +#endif + curl_easy_setopt(ch, CURLOPT_HEADER, 0L); + curl_easy_setopt(ch, CURLOPT_FILETIME, 1L); + curl_easy_setopt(ch, CURLOPT_AUTOREFERER, 1L); + curl_easy_setopt(ch, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, php_http_curle_header_callback); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, php_http_curle_body_callback); + curl_easy_setopt(ch, CURLOPT_DEBUGFUNCTION, php_http_curle_raw_callback); + curl_easy_setopt(ch, CURLOPT_READFUNCTION, php_http_curle_read_callback); + curl_easy_setopt(ch, CURLOPT_SEEKFUNCTION, php_http_curle_seek_callback); +#if PHP_HTTP_CURL_VERSION(7,32,0) + curl_easy_setopt(ch, CURLOPT_XFERINFOFUNCTION, php_http_curle_xferinfo_callback); + curl_easy_setopt(ch, CURLOPT_XFERINFODATA, handler); +#else + curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, php_http_curle_progress_callback); + curl_easy_setopt(ch, CURLOPT_PROGRESSDATA, handler); +#endif + curl_easy_setopt(ch, CURLOPT_DEBUGDATA, handler); + curl_easy_setopt(ch, CURLOPT_WRITEDATA, handler); + curl_easy_setopt(ch, CURLOPT_HEADERDATA, handler); +#if DEBUG_COOKIES + fprintf(stderr, "CURLOPT_SHARE: %p\n", curl->handle->share); +#endif + curl_easy_setopt(ch, CURLOPT_SHARE, curl->handle->share); return SUCCESS; } @@ -2111,7 +2161,6 @@ static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_ static php_http_client_curl_handler_t *php_http_client_curl_handler_init(php_http_client_t *h, php_resource_factory_t *rf) { void *handle; - php_http_client_curl_t *curl = h->ctx; php_http_client_curl_handler_t *handler; if (!(handle = php_resource_factory_handle_ctor(rf, NULL))) { @@ -2129,31 +2178,6 @@ static php_http_client_curl_handler_t *php_http_client_curl_handler_init(php_htt php_http_buffer_init(&handler->options.ranges); zend_hash_init(&handler->options.cache, 0, NULL, ZVAL_PTR_DTOR, 0); -#if ZTS - curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L); -#endif - curl_easy_setopt(handle, CURLOPT_HEADER, 0L); - curl_easy_setopt(handle, CURLOPT_FILETIME, 1L); - curl_easy_setopt(handle, CURLOPT_AUTOREFERER, 1L); - curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, php_http_curle_header_callback); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, php_http_curle_body_callback); - curl_easy_setopt(handle, CURLOPT_DEBUGFUNCTION, php_http_curle_raw_callback); - curl_easy_setopt(handle, CURLOPT_READFUNCTION, php_http_curle_read_callback); - curl_easy_setopt(handle, CURLOPT_SEEKFUNCTION, php_http_curle_seek_callback); -#if PHP_HTTP_CURL_VERSION(7,32,0) - curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, php_http_curle_xferinfo_callback); - curl_easy_setopt(handle, CURLOPT_XFERINFODATA, handler); -#else - curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, php_http_curle_progress_callback); - curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, handler); -#endif - curl_easy_setopt(handle, CURLOPT_DEBUGDATA, handler); - curl_easy_setopt(handle, CURLOPT_WRITEDATA, handler); - curl_easy_setopt(handle, CURLOPT_HEADERDATA, handler); - curl_easy_setopt(handle, CURLOPT_SHARE, curl->handle->share); - php_http_client_curl_handler_reset(handler); return handler; @@ -2277,11 +2301,18 @@ static void php_http_client_curl_handler_clear(php_http_client_curl_handler_t *h #endif curl_easy_setopt(handler->handle, CURLOPT_VERBOSE, 0L); curl_easy_setopt(handler->handle, CURLOPT_DEBUGFUNCTION, NULL); + /* see gh issue #84 */ +#if DEBUG_COOKIES + fprintf(stderr, "CURLOPT_COOKIELIST: FLUSH\n"); + fprintf(stderr, "CURLOPT_SHARE: (null)\n"); +#endif curl_easy_setopt(handler->handle, CURLOPT_COOKIELIST, "FLUSH"); curl_easy_setopt(handler->handle, CURLOPT_SHARE, NULL); - /* see gh issue #84 */ #if PHP_HTTP_CURL_VERSION(7,63,0) && !PHP_HTTP_CURL_VERSION(7,65,0) - curl_easy_setopt(handler->handle, CURLOPT_COOKIEJAR, NULL); + { + php_http_curle_storage_t *st = php_http_curle_get_storage(handler->handle); + curl_easy_setopt(handler->handle, CURLOPT_COOKIEJAR, st ? st->cookiestore : NULL); + } #endif } @@ -2362,6 +2393,17 @@ static void queue_dtor(php_http_client_enqueue_t *e) php_http_client_curl_handler_dtor(handler); } +static void retire_ch(php_persistent_handle_factory_t *f, void **handle) +{ + CURL *ch = *handle; + /* erase all cookies */ + if (ch) { + curl_easy_reset(ch); + curl_easy_setopt(ch, CURLOPT_COOKIELIST, "ALL"); + curl_easy_setopt(ch, CURLOPT_COOKIEFILE, NULL); + } +} + static php_resource_factory_t *create_rf(php_http_client_t *h, php_http_client_enqueue_t *enqueue) { php_persistent_handle_factory_t *pf = NULL; @@ -2392,7 +2434,7 @@ static php_resource_factory_t *create_rf(php_http_client_t *h, php_http_client_e id_len = spprintf(&id_str, 0, "%.*s:%s:%d", (int) phf->ident->len, phf->ident->val, STR_PTR(url->host), port); id = php_http_cs2zs(id_str, id_len); - pf = php_persistent_handle_concede(NULL, PHP_HTTP_G->client.curl.driver.request_name, id, NULL, NULL); + pf = php_persistent_handle_concede(NULL, PHP_HTTP_G->client.curl.driver.request_name, id, NULL, retire_ch); zend_string_release(id); } @@ -2450,6 +2492,43 @@ static ZEND_RESULT_CODE php_http_client_curl_enqueue(php_http_client_t *h, php_h return SUCCESS; } +static ZEND_RESULT_CODE php_http_client_curl_requeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) +{ + CURLMcode rs; + php_http_client_curl_t *curl = h->ctx; + php_http_client_curl_handler_t *handler = enqueue->opaque; + php_http_client_progress_state_t *progress; + + if (SUCCESS != php_http_client_curl_handler_reset(handler)) { + return FAILURE; + } + + if (SUCCESS != php_http_client_curl_handler_prepare(handler, enqueue)) { + return FAILURE; + } + + if (CURLM_OK != (rs = curl_multi_remove_handle(curl->handle->multi, handler->handle))) { + php_error_docref(NULL, E_WARNING, "Could not dequeue request: %s", curl_multi_strerror(rs)); + return FAILURE; + } + + if (CURLM_OK != (rs = curl_multi_add_handle(curl->handle->multi, handler->handle))) { + zend_llist_del_element(&h->requests, handler->handle, (int (*)(void *, void *)) compare_queue); + php_error_docref(NULL, E_WARNING, "Could not enqueue request: %s", curl_multi_strerror(rs)); + return FAILURE; + } + + ++curl->unfinished; + + if (h->callback.progress.func && SUCCESS == php_http_client_getopt(h, PHP_HTTP_CLIENT_OPT_PROGRESS_INFO, enqueue->request, &progress)) { + progress->info = "start"; + h->callback.progress.func(h->callback.progress.arg, h, &handler->queue, progress); + progress->started = 1; + } + + return SUCCESS; +} + static ZEND_RESULT_CODE php_http_client_curl_dequeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) { CURLMcode rs; @@ -2566,6 +2645,8 @@ static ZEND_RESULT_CODE php_http_client_curl_setopt(php_http_client_t *h, php_ht { php_http_client_curl_t *curl = h->ctx; + (void) curl; + switch (opt) { case PHP_HTTP_CLIENT_OPT_CONFIGURATION: return php_http_options_apply(&php_http_curlm_options, (HashTable *) arg, h); @@ -2670,6 +2751,7 @@ static php_http_client_ops_t php_http_client_curl_ops = { php_http_client_curl_once, php_http_client_curl_enqueue, php_http_client_curl_dequeue, + php_http_client_curl_requeue, php_http_client_curl_setopt, php_http_client_curl_getopt }; diff --git a/tests/client002.phpt b/tests/client002.phpt index 0da72d0..d020f16 100644 --- a/tests/client002.phpt +++ b/tests/client002.phpt @@ -17,8 +17,10 @@ class Observer implements SplObserver #[ReturnTypeWillChange] function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) { echo "P"; - if ($progress->info !== "prepare" && $client->getProgressInfo($request) != $progress) { - var_dump($progress); + /* fence against buggy infof() calls in some curl versions */ + $compare = $client->getProgressInfo($request); + if ($progress->info !== "prepare" && $compare && $compare != $progress) { + var_dump($progress, $compare); } } } diff --git a/tests/client009.phpt b/tests/client009.phpt index 6aea225..0eb08f7 100644 --- a/tests/client009.phpt +++ b/tests/client009.phpt @@ -19,24 +19,33 @@ function x($a) { } server("env.inc", function($port) { + $client = new http\Client; + $client->setCookies(array("test" => "bar")); + $client->addCookies(array("foo" => "test")); $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + echo $client->getResponse()->getBody()->toString(); - foreach (http\Client::getAvailableDrivers() as $driver) { - $client = new http\Client($driver); - $client->setCookies(array("test" => "bar")); - $client->addCookies(array("foo" => "test")); - $client->enqueue($request); - $client->send(); - var_dump($client->getResponse()->getBody()->toString()); - $request->setOptions(array("cookies" => x($client->getCookies()))); - $client->requeue($request); - $client->send(); - var_dump($client->getResponse()->getBody()->toString()); - } + $request->setOptions(array("cookies" => x($client->getCookies()))); + $client->requeue($request); + $client->send(); + + echo $client->getResponse()->getBody()->toString(); }); ?> Done ---EXPECTREGEX-- +--EXPECT-- Test -(?:string\(46\) "Array\n\(\n \[test\] \=\> bar\n \[foo\] \=\> test\n\)\n"\nstring\(46\) "Array\n\(\n \[test\] \=\> test\n \[foo\] \=\> bar\n\)\n"\n)+Done +Array +( + [test] => bar + [foo] => test +) +Array +( + [test] => test + [foo] => bar +) +Done diff --git a/tests/client021.phpt b/tests/client021.phpt index 702685d..aaf4625 100644 --- a/tests/client021.phpt +++ b/tests/client021.phpt @@ -4,6 +4,9 @@ client cookies --FILE-- configure(array("pipelining" => false)); + $client->configure(array("pipelining" => false, "share_cookies" => false)); + $request = new http\Client\Request("GET", "http://localhost:$port?r1"); $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => 1]); + $client->requeue($request); + $client->send(); + dump_responses($client, ["counter" => 2]); + $client->dequeue($request); + $request = new http\Client\Request("GET", "http://localhost:$port?r2"); $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => 1]); }); ?> @@ -44,7 +46,7 @@ Set-Cookie: counter=2; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=2; +Set-Cookie: counter=1; X-Original-Transfer-Encoding: chunked ===DONE=== diff --git a/tests/client031.phpt b/tests/client031.phpt index 3211735..73ce7e4 100644 --- a/tests/client031.phpt +++ b/tests/client031.phpt @@ -16,32 +16,29 @@ echo "Test\n"; server("cookie.inc", function($port) { $client = new http\Client(null, "cookies"); $client->configure(array("share_cookies" => false)); + $request = new http\Client\Request("GET", "http://localhost:$port"); $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => 1]); + /* requeue the previous request */ $client->requeue($request); - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); - $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); + dump_responses($client, ["counter" => 2]); + + for($i = 0; $i < 3; ++$i) { + /* new requests */ + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + dump_responses($client, ["counter" => 1]); } - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); + + /* requeue the previous request */ + $client->requeue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => 2]); }); ?> @@ -53,11 +50,11 @@ Set-Cookie: counter=1; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=1; +Set-Cookie: counter=2; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=2; +Set-Cookie: counter=1; X-Original-Transfer-Encoding: chunked Etag: "" @@ -68,4 +65,8 @@ Etag: "" Set-Cookie: counter=1; X-Original-Transfer-Encoding: chunked +Etag: "" +Set-Cookie: counter=2; +X-Original-Transfer-Encoding: chunked + ===DONE=== diff --git a/tests/client032.phpt b/tests/client032.phpt index d8dfb2b..954a68e 100644 --- a/tests/client032.phpt +++ b/tests/client032.phpt @@ -16,32 +16,29 @@ echo "Test\n"; server("cookie.inc", function($port) { $client = new http\Client(null, "cookies"); $client->configure(array("share_cookies" => true)); + $request = new http\Client\Request("GET", "http://localhost:$port"); $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => 1]); + /* requeue the previous request */ $client->requeue($request); - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); - $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); + dump_responses($client, ["counter" => 2]); + + for($i = 3; $i < 6; ++$i) { + /* new requests */ + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + dump_responses($client, ["counter" => $i]); } - $request = new http\Client\Request("GET", "http://localhost:$port"); - $client->enqueue($request); + + /* requeue the previous request */ + $client->requeue($request); $client->send(); - while (($r = $client->getResponse())) { - dump_headers(null, $r->getHeaders()); - } + dump_responses($client, ["counter" => $i]); }); ?> @@ -57,15 +54,19 @@ Set-Cookie: counter=2; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=2; +Set-Cookie: counter=3; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=3; +Set-Cookie: counter=4; X-Original-Transfer-Encoding: chunked Etag: "" -Set-Cookie: counter=4; +Set-Cookie: counter=5; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=6; X-Original-Transfer-Encoding: chunked ===DONE=== diff --git a/tests/helper/dump.inc b/tests/helper/dump.inc index 452a715..5612d06 100644 --- a/tests/helper/dump.inc +++ b/tests/helper/dump.inc @@ -24,4 +24,17 @@ function dump_message($stream, http\Message $msg, $parent = false) { } } -?> \ No newline at end of file +function dump_responses($client, array $expect_cookie = []) { + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + if ($expect_cookie) { + $got_cookies = array_merge(...array_map(fn($c) => $c->getCookies(), $r->getCookies())); + if ($expect_cookie != $got_cookies) { + var_dump($expect_cookie, $got_cookies); + echo $r->toString(true); + } + } + } + +} +?>