summaryrefslogtreecommitdiffstats
path: root/src/net/tcp
diff options
context:
space:
mode:
authorMichael Brown2014-03-25 16:42:46 +0100
committerMichael Brown2014-03-25 16:46:14 +0100
commite845b7da9b8203a9f1f1b2ca9ae6306d6d8168be (patch)
tree0b3b035a4f56935ccf4ddd9640c02d66ea98e131 /src/net/tcp
parent[bios] Fix screen clearing on even more buggy BIOSes (diff)
downloadipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.tar.gz
ipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.tar.xz
ipxe-e845b7da9b8203a9f1f1b2ca9ae6306d6d8168be.zip
[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/tcp')
-rw-r--r--src/net/tcp/httpcore.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/tcp/httpcore.c b/src/net/tcp/httpcore.c
index aa15b112..6552ca2b 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;