From e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 25 Mar 2014 15:42:46 +0000 Subject: [http] Accept Content-Length header with trailing whitespace At least one HTTP server (Google's OCSP responder) has been observed to generate a Content-Length header with trailing whitespace. Signed-off-by: Michael Brown --- src/net/tcp/httpcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/tcp/httpcore.c b/src/net/tcp/httpcore.c index aa15b11..6552ca2 100644 --- a/src/net/tcp/httpcore.c +++ b/src/net/tcp/httpcore.c @@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include #include @@ -441,7 +442,7 @@ static int http_rx_content_length ( struct http_request *http, char *value ) { /* Parse content length */ content_len = strtoul ( value, &endp, 10 ); - if ( *endp != '\0' ) { + if ( ! ( ( *endp == '\0' ) || isspace ( *endp ) ) ) { DBGC ( http, "HTTP %p invalid Content-Length \"%s\"\n", http, value ); return -EINVAL_CONTENT_LENGTH; -- cgit v1.1