From 370a2c02133c11d4eaab4aa552e49e9ed8b24658 Mon Sep 17 00:00:00 2001 From: Artem Germanov Date: Sun, 20 May 2012 21:08:52 -0700 Subject: [PATCH] ignore LWS after field-content in headers --- http.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/http.c b/http.c index 34d1dc96..a6d9ab3a 100644 --- a/http.c +++ b/http.c @@ -219,6 +219,20 @@ strsep(char **s, const char *del) } #endif +static void +rtrim(char *str) +{ + char *cp; + + if( str == NULL ) + return; + + cp = strchr(str, '\0') - 1; + + while (cp >= str && *cp == ' ') + *cp-- = '\0'; +} + static size_t html_replace(const char ch, const char **escaped) { @@ -1913,6 +1927,7 @@ evhttp_parse_headers_(struct evhttp_request *req, struct evbuffer* buffer) goto error; svalue += strspn(svalue, " "); + rtrim(svalue); if (evhttp_add_header(headers, skey, svalue) == -1) goto error;