summaryrefslogtreecommitdiffstats
path: root/pecl_http-upstream.patch
blob: 9b204b22315aca7581607c3859c29b019bd28e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
From 62e6b88c7223f15646c8dcfd0e974b03cd5cf63a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Thu, 19 Feb 2015 17:12:46 +0100
Subject: [PATCH] honours TEST_PHP_EXECUTABLE and TEST_PHP_ARGS (set by "make
 test")

---
 tests/helper/server.inc | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/tests/helper/server.inc b/tests/helper/server.inc
index aa8559f..3d49a85 100644
--- a/tests/helper/server.inc
+++ b/tests/helper/server.inc
@@ -1,8 +1,13 @@
-<?php 
+<?php
 
-// PHP-5.3
-if (!defined("PHP_BINARY")) {
-	define("PHP_BINARY", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
+$php = getenv('TEST_PHP_EXECUTABLE');
+if ($php) {
+	define('PHP_BIN', $php);
+} else if (defined('PHP_BINARY')) {
+	define('PHP_BIN', PHP_BINARY);
+} else {
+	// PHP-5.3
+	define("PHP_BIN", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
 }
 
 function serve($cb) {
@@ -35,7 +40,12 @@ function serve($cb) {
 }
 
 function server($handler, $cb) {
-	proc(PHP_BINARY, array(__DIR__."/$handler"), $cb);
+	$args = explode(' ', getenv('TEST_PHP_ARGS'));
+	$args[] = __DIR__."/$handler";
+	foreach ($args as $k => $v) {
+		if (!$v) unset($args[$k]);
+	}
+	proc(PHP_BIN, $args, $cb);
 }
 
 function nghttpd($cb) {
@@ -77,7 +87,7 @@ function proc($bin, $args, $cb) {
 		$stdin = $pipes[0];
 		$stdout = $pipes[1];
 		$stderr = $pipes[2];
-		
+
 		do {
 			$port = trim(fgets($stderr));
 			$R = array($stderr); $W = array(); $E = array();
-- 
2.1.4

From 455306442cd599c5a5750a70053b1a5f47b08538 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Thu, 19 Feb 2015 17:22:58 +0100
Subject: [PATCH] change base port to make 32/64 simultenaous build easier

---
 tests/helper/server.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/helper/server.inc b/tests/helper/server.inc
index 3d49a85..265a861 100644
--- a/tests/helper/server.inc
+++ b/tests/helper/server.inc
@@ -11,7 +11,7 @@ if ($php) {
 }
 
 function serve($cb) {
-	foreach (range(8000, 9000) as $port) {
+	foreach (range(8000+PHP_INT_SIZE, 9000) as $port) {
 		if (($server = @stream_socket_server("tcp://localhost:$port"))) {
 			fprintf(STDERR, "%s\n", $port);
 			do {
@@ -50,7 +50,7 @@ function server($handler, $cb) {
 
 function nghttpd($cb) {
 	$spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w"));
-	foreach (range(8000, 9000) as $port) {
+	foreach (range(8000+PHP_INT_SIZE, 9000) as $port) {
 		$comm = "exec nghttpd -d html $port http2.key http2.crt";
 		if (($proc = proc_open($comm, $spec, $pipes, __DIR__))) {
 			$stdin = $pipes[0];
-- 
2.1.4

From a7d0b03fc81daac03ac56f7506d489540ef12921 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Thu, 19 Feb 2015 20:33:35 +0100
Subject: [PATCH] missing backport from phpng branch

---
 php_http_env_response.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/php_http_env_response.c b/php_http_env_response.c
index 2f2f161..0bcc21d 100644
--- a/php_http_env_response.c
+++ b/php_http_env_response.c
@@ -926,7 +926,7 @@ static void php_http_env_response_stream_dtor(php_http_env_response_t *r)
 	TSRMLS_FETCH_FROM_CTX(r->ts);
 
 	if (ctx->chunked_filter) {
-		php_stream_filter_free(ctx->chunked_filter TSRMLS_CC);
+		ctx->chunked_filter = php_stream_filter_remove(ctx->chunked_filter, 1 TSRMLS_CC);
 	}
 	zend_hash_destroy(&ctx->header);
 	zend_list_delete(ctx->stream->rsrc_id);
-- 
2.1.4

From d58b92645e59dd5d50f78c5609c60577d7628d49 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Thu, 19 Feb 2015 20:34:09 +0100
Subject: [PATCH] skip on older libcurl

---
 tests/client019.phpt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/client019.phpt b/tests/client019.phpt
index e60e5aa..a69254b 100644
--- a/tests/client019.phpt
+++ b/tests/client019.phpt
@@ -4,13 +4,16 @@ client proxy - send proxy headers for a proxy request
 <?php 
 include "skipif.inc";
 skip_client_test();
+$client = new http\Client("curl");
+array_key_exists("proxyheader", $client->getAvailableOptions())
+	or die("skip need libcurl with CUTLOPT_PROXYHEADER support\n");
 ?>
 --FILE--
 <?php
 
 include "helper/server.inc";
 
-echo "Test\n";
+echo "Test\n";var_dump((new http\Client)->getAvailableOptions());
 
 server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
 	echo "Server on port $port\n";
-- 
2.1.4

From 57476a6466e4f3c41cdf359568e2b3722a33c373 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Thu, 19 Feb 2015 20:34:31 +0100
Subject: [PATCH] minor C-L bug in older libcurl

---
 tests/client025.phpt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/client025.phpt b/tests/client025.phpt
index 866cd2e..3c4793e 100644
--- a/tests/client025.phpt
+++ b/tests/client025.phpt
@@ -18,7 +18,7 @@ server("proxy.inc", function($port) {
 	$request->getBody()->append("123");
 	echo $client->enqueue($request)->send()->getResponse();
 });
-
+// Content-length is 2 instead of 3 in older libcurls
 ?>
 ===DONE===
 --EXPECTF--
@@ -34,8 +34,8 @@ Content-Range: bytes 1-2/3
 User-Agent: %s
 Host: localhost:%d
 Accept: */*
-Content-Length: 3
+Content-Length: %d
 Expect: 100-continue
-X-Original-Content-Length: 3
+X-Original-Content-Length: %d
 
 23===DONE===
-- 
2.1.4

From 762ce165685c677e780b87668658c939bd88c709 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Thu, 19 Feb 2015 21:07:03 +0100
Subject: [PATCH] use a random port offset

---
 tests/helper/server.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/helper/server.inc b/tests/helper/server.inc
index 265a861..e3b7af6 100644
--- a/tests/helper/server.inc
+++ b/tests/helper/server.inc
@@ -11,7 +11,11 @@ if ($php) {
 }
 
 function serve($cb) {
-	foreach (range(8000+PHP_INT_SIZE, 9000) as $port) {
+	/* stream_socket_server() automatically sets SO_REUSEADDR, 
+	 * which is, well, bad if the tests are run in parallel
+	 */
+	$offset = rand(0,2000);
+	foreach (range(8000+$offset, 9000+$offset) as $port) {
 		if (($server = @stream_socket_server("tcp://localhost:$port"))) {
 			fprintf(STDERR, "%s\n", $port);
 			do {
-- 
2.1.4

From f77326f8677648ea24c5906d05088fc79b9bb4e7 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Thu, 19 Feb 2015 21:13:05 +0100
Subject: [PATCH] here too

---
 tests/helper/server.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/helper/server.inc b/tests/helper/server.inc
index e3b7af6..506e083 100644
--- a/tests/helper/server.inc
+++ b/tests/helper/server.inc
@@ -54,7 +54,8 @@ function server($handler, $cb) {
 
 function nghttpd($cb) {
 	$spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w"));
-	foreach (range(8000+PHP_INT_SIZE, 9000) as $port) {
+	$offset = rand(0,2000);
+	foreach (range(8000+$offset, 9000+$offset) as $port) {
 		$comm = "exec nghttpd -d html $port http2.key http2.crt";
 		if (($proc = proc_open($comm, $spec, $pipes, __DIR__))) {
 			$stdin = $pipes[0];
-- 
2.1.4

From 363e0e603056c2934ad587a7c7fa17e2b203c07b Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Fri, 20 Feb 2015 08:46:40 +0100
Subject: [PATCH] cleanup debug stuff

---
 tests/client019.phpt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/client019.phpt b/tests/client019.phpt
index a69254b..c41a260 100644
--- a/tests/client019.phpt
+++ b/tests/client019.phpt
@@ -13,7 +13,7 @@ array_key_exists("proxyheader", $client->getAvailableOptions())
 
 include "helper/server.inc";
 
-echo "Test\n";var_dump((new http\Client)->getAvailableOptions());
+echo "Test\n";
 
 server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
 	echo "Server on port $port\n";
-- 
2.1.4