Skip to content

Commit 1af8b3f

Browse files
author
zoe slattery
committed
Change impl of GZIP_POST, DEFLATE_POST. See #62021
1 parent 3332943 commit 1af8b3f

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

ext/soap/tests/server019.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SOAP Server 19: compressed request (gzip)
88
?>
99
--INI--
1010
precision=14
11-
--POST--
11+
--GZIP_POST--
1212
<SOAP-ENV:Envelope
1313
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
1414
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
@@ -19,8 +19,6 @@ precision=14
1919
<ns1:test xmlns:ns1="http://testuri.org" />
2020
</SOAP-ENV:Body>
2121
</SOAP-ENV:Envelope>
22-
--GZIP_POST--
23-
1
2422
--FILE--
2523
<?php
2624
function test() {

ext/soap/tests/server020.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SOAP Server 20: compressed request (deflate)
88
?>
99
--INI--
1010
precision=14
11-
--POST--
11+
--DEFLATE_POST--
1212
<?xml version="1.0" encoding="ISO-8859-1"?>
1313
<SOAP-ENV:Envelope
1414
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
@@ -20,8 +20,6 @@ precision=14
2020
<ns1:test xmlns:ns1="http://testuri.org" />
2121
</SOAP-ENV:Body>
2222
</SOAP-ENV:Envelope>
23-
--DEFLATE_POST--
24-
1
2523
--FILE--
2624
<?php
2725
function test() {

run-tests.php

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ function run_test($php, $file, $env)
13151315
$tested = trim($section_text['TEST']);
13161316

13171317
/* For GET/POST/PUT tests, check if cgi sapi is available and if it is, use it. */
1318-
if (!empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) {
1318+
if (!empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['GZIP_POST']) || !empty($section_text['DEFLATE_POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) {
13191319
if (isset($php_cgi)) {
13201320
$old_php = $php;
13211321
$php = $php_cgi . ' -C ';
@@ -1700,15 +1700,6 @@ function run_test($php, $file, $env)
17001700
} else if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
17011701

17021702
$post = trim($section_text['POST']);
1703-
1704-
if (array_key_exists('GZIP_POST', $section_text) && function_exists('gzencode')) {
1705-
$post = gzencode($post, 9, FORCE_GZIP);
1706-
$env['HTTP_CONTENT_ENCODING'] = 'gzip';
1707-
} else if (array_key_exists('DEFLATE_POST', $section_text) && function_exists('gzcompress')) {
1708-
$post = gzcompress($post, 9);
1709-
$env['HTTP_CONTENT_ENCODING'] = 'deflate';
1710-
}
1711-
17121703
save_text($tmp_post, $post);
17131704
$content_length = strlen($post);
17141705

@@ -1718,6 +1709,35 @@ function run_test($php, $file, $env)
17181709

17191710
$cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\"";
17201711

1712+
} else if (array_key_exists('GZIP_POST', $section_text) && !empty($section_text['GZIP_POST'])) {
1713+
1714+
$post = trim($section_text['GZIP_POST']);
1715+
$post = gzencode($post, 9, FORCE_GZIP);
1716+
$env['HTTP_CONTENT_ENCODING'] = 'gzip';
1717+
1718+
save_text($tmp_post, $post);
1719+
$content_length = strlen($post);
1720+
1721+
$env['REQUEST_METHOD'] = 'POST';
1722+
$env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
1723+
$env['CONTENT_LENGTH'] = $content_length;
1724+
1725+
$cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\"";
1726+
1727+
} else if (array_key_exists('DEFLATE_POST', $section_text) && !empty($section_text['DEFLATE_POST'])) {
1728+
$post = trim($section_text['DEFLATE_POST']);
1729+
$post = gzcompress($post, 9);
1730+
$env['HTTP_CONTENT_ENCODING'] = 'deflate';
1731+
save_text($tmp_post, $post);
1732+
$content_length = strlen($post);
1733+
1734+
$env['REQUEST_METHOD'] = 'POST';
1735+
$env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
1736+
$env['CONTENT_LENGTH'] = $content_length;
1737+
1738+
$cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\"";
1739+
1740+
17211741
} else {
17221742

17231743
$env['REQUEST_METHOD'] = 'GET';

0 commit comments

Comments
 (0)