From 0aa2ea74e3fcc181fd70e2968320a9803e685bcc Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sat, 26 Mar 2016 11:32:13 +0000 Subject: [PATCH] [mod_proxy] accept LF delimited headers, not just CRLF (fixes #2594) From: Glenn Strauss git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3126 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_proxy.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) 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 */