ignore LWS after field-content in headers

This commit is contained in:
Artem Germanov 2012-05-20 21:08:52 -07:00 committed by Nick Mathewson
parent c181399e92
commit 370a2c0213

15
http.c
View File

@ -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;