diff options
author | Michael Brown <mcb30@ipxe.org> | 2014-03-25 15:42:46 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2014-03-25 15:46:14 +0000 |
commit | e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be (patch) | |
tree | 0b3b035a4f56935ccf4ddd9640c02d66ea98e131 /src/net | |
parent | c1595129b51940bb620302d6da5accef50626da9 (diff) | |
download | ipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.zip ipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.tar.gz ipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.tar.bz2 |
[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 <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tcp/httpcore.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 <strings.h> #include <byteswap.h> #include <errno.h> +#include <ctype.h> #include <assert.h> #include <ipxe/uri.h> #include <ipxe/refcnt.h> @@ -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; |