summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2020-08-18 18:27:26 +0200
committerMatteo Beccati <mbeccati@php.net>2020-08-18 18:27:26 +0200
commit3877172411e7b7f2081af39dfe293e399c98731c (patch)
treea827d625d06908fbcc2631d4a8241f371f554827 /ext/soap/php_http.c
parent48d712565ca2c2c6cfd50bb4491df94fd1f05f9d (diff)
parentf7c43b8c72822a4722bd7404c6f65e15b2b912c1 (diff)
downloadphp-git-3877172411e7b7f2081af39dfe293e399c98731c.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #47021: SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked"
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 299fe23a82..0abbefa8a2 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -1367,11 +1367,24 @@ static char *get_http_header_value(char *headers, char *type)
/* match */
tmp = pos + typelen;
+
+ /* strip leading whitespace */
+ while (*tmp == ' ' || *tmp == '\t') {
+ tmp++;
+ }
+
eol = strchr(tmp, '\n');
if (eol == NULL) {
eol = headers + headerslen;
- } else if (eol > tmp && *(eol-1) == '\r') {
- eol--;
+ } else if (eol > tmp) {
+ if (*(eol-1) == '\r') {
+ eol--;
+ }
+
+ /* strip trailing whitespace */
+ while (eol > tmp && (*(eol-1) == ' ' || *(eol-1) == '\t')) {
+ eol--;
+ }
}
return estrndup(tmp, eol - tmp);
}