summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
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);
}