diff options
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 17 |
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); } |