diff --git a/NEWS b/NEWS index 46777200..ba1cdeca 100644 --- a/NEWS +++ b/NEWS @@ -50,6 +50,7 @@ NEWS * validate return values from strtol, strtoul (fixes #2564) * [mod_ssi] Add SSI vars SCRIPT_{URI,URL} and REQUEST_SCHEME (fixes #2721) * [config] warn if server.upload-dirs has non-existent dirs (fixes #2508) + * [mod_proxy] accept LF delimited headers, not just CRLF (fixes #2594) - 1.4.39 - 2016-01-02 * [core] fix memset_s call (fixes #2698) diff --git a/src/mod_proxy.c b/src/mod_proxy.c index 8f46cf32..90a7517f 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -532,18 +532,18 @@ static int proxy_response_parse(server *srv, connection *con, plugin_data *p, bu UNUSED(srv); - /* \r\n -> \0\0 */ + /* [\r]\n -> [\0]\0 */ buffer_copy_buffer(p->parse_response, in); - for (s = p->parse_response->ptr; NULL != (ns = strstr(s, "\r\n")); s = ns + 2) { + for (s = p->parse_response->ptr; NULL != (ns = strchr(s, '\n')); s = ns + 1) { char *key, *value; int key_len; data_string *ds; int copy_header; ns[0] = '\0'; - ns[1] = '\0'; + if (s != ns && ns[-1] == '\r') ns[-1] = '\0'; if (-1 == http_response_status) { /* The first line of a Response message is the Status-Line */