diff options
-rw-r--r-- | bug69313.phpt | 46 | ||||
-rw-r--r-- | php-pecl-http.spec | 20 | ||||
-rw-r--r-- | querystring003.phpt | 22 | ||||
-rw-r--r-- | upload.inc | 20 |
4 files changed, 107 insertions, 1 deletions
diff --git a/bug69313.phpt b/bug69313.phpt new file mode 100644 index 0000000..824918c --- /dev/null +++ b/bug69313.phpt @@ -0,0 +1,46 @@ +--TEST-- +Bug #69313 (http\Client doesn't send GET body) +--SKIPIF-- +<?php +include "./skipif.inc"; +skip_client_test(); +?> +--FILE-- +<?php + + +include "helper/server.inc"; + +echo "Test\n"; + +server("proxy.inc", function($port, $stdin, $stdout, $stderr) { + $request = new http\Client\Request("GET", "http://localhost:$port/"); + $request->setHeader("Content-Type", "text/plain"); + $request->getBody()->append("foo"); + $client = new http\Client(); + $client->enqueue($request); + $client->send(); + echo $client->getResponse(); +}); + +?> + +Done +--EXPECTF-- +Test +HTTP/1.1 200 OK +Accept-Ranges: bytes +Etag: "%s" +X-Original-Transfer-Encoding: chunked +Content-Length: %d + +GET / HTTP/1.1 +User-Agent: %s +Host: localhost:%d +Accept: */* +Content-Type: text/plain +Content-Length: 3 +X-Original-Content-Length: 3 + +foo +Done diff --git a/php-pecl-http.spec b/php-pecl-http.spec index 94c3a2a..02d9032 100644 --- a/php-pecl-http.spec +++ b/php-pecl-http.spec @@ -33,7 +33,7 @@ #global prever RC1 Name: %{?scl_prefix}php-pecl-http -Version: 2.4.2 +Version: 2.4.3 Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Summary: Extended HTTP support @@ -45,6 +45,14 @@ Source0: http://pecl.php.net/get/%{proj_name}-%{version}%{?prever}.tgz # From http://www.php.net/manual/en/http.configuration.php Source1: %{proj_name}.ini +# http://git.php.net/?p=pecl/http/pecl_http.git;a=blob_plain;f=tests/helper/upload.inc;hb=HEAD +# See http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=5c5ee386409f5b6d697c483edc788d09f8c8aeb3 +Source2: upload.inc +# http://git.php.net/?p=pecl/http/pecl_http.git;a=blob_plain;f=tests/querystring003.phpt;hb=HEAD +Source3: querystring003.phpt +# http://git.php.net/?p=pecl/http/pecl_http.git;a=blob_plain;f=tests/bug69313.phpt;hb=HEAD +Source4: bug69313.phpt + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel >= 5.3.0 BuildRequires: %{?scl_prefix}php-hash @@ -126,6 +134,10 @@ Obsoletes: php55w-pecl-http <= %{version} Obsoletes: php56u-pecl-http <= %{version} Obsoletes: php56w-pecl-http <= %{version} %endif +%if "%{php_version}" > "7.0" +Obsoletes: php70u-pecl-http <= %{version} +Obsoletes: php70w-pecl-http <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -181,6 +193,9 @@ These are the files needed to compile programs using HTTP extension. mv %{proj_name}-%{version}%{?prever} NTS cd NTS +cp %{SOURCE2} tests/helper/ +cp %{SOURCE3} %{SOURCE4} tests/ + extver=$(sed -n '/#define PHP_PECL_HTTP_VERSION/{s/.* "//;s/".*$//;p}' php_http.h) if test "x${extver}" != "x%{version}%{?prever}"; then : Error: Upstream HTTP version is now ${extver}, expecting %{version}%{?prever}. @@ -350,6 +365,9 @@ rm -rf %{buildroot} %changelog +* Wed Apr 08 2015 Remi Collet <remi@fedoraproject.org> - 2.4.3-1 +- Update to 2.4.3 + * Fri Apr 03 2015 Remi Collet <remi@fedoraproject.org> - 2.4.2-1 - Update to 2.4.2 diff --git a/querystring003.phpt b/querystring003.phpt new file mode 100644 index 0000000..a504174 --- /dev/null +++ b/querystring003.phpt @@ -0,0 +1,22 @@ +--TEST-- +querystring offset set +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php + +echo "Test\n"; + +$qs = new http\QueryString("foo=bar&bar=baz"); +echo $qs,"\n"; +$qs["foo"] = "baz"; +echo $qs,"\n"; +?> +===DONE=== +--EXPECT-- +Test +foo=bar&bar=baz +foo=baz&bar=baz +===DONE=== diff --git a/upload.inc b/upload.inc new file mode 100644 index 0000000..9502d2b --- /dev/null +++ b/upload.inc @@ -0,0 +1,20 @@ +<?php + +include "server.inc"; + +serve(function($client) { + $request = new http\Message($client, false); + + if ($request->getHeader("Expect") === "100-continue") { + $response = new http\Env\Response; + $response->setEnvRequest($request); + $response->setResponseCode(100); + $response->send($client); + } + + /* return the initial message as response body */ + $response = new http\Env\Response; + /* avoid OOM with $response->getBody()->append($request); */ + $request->toStream($response->getBody()->getResource()); + $response->send($client); +}); |