summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2020-08-18 18:31:11 +0200
committerMatteo Beccati <mbeccati@php.net>2020-08-18 18:31:11 +0200
commitcf3fb1467998a3f967218dd968f1d094078af362 (patch)
tree6ba8923c49c60d4679c7c7cfe019c5bfedaedcb6 /ext/soap/php_http.c
parentc905717dfa6c47e77f473b6d7800523585bd23a5 (diff)
parent3877172411e7b7f2081af39dfe293e399c98731c (diff)
downloadphp-git-cf3fb1467998a3f967218dd968f1d094078af362.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: 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 8b251155fd..03fcc46776 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -1365,11 +1365,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);
}