david/ipxe
Archived
1
0

[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>
This commit is contained in:
Michael Brown 2014-03-25 15:42:46 +00:00
parent c1595129b5
commit e845b7da9b

View File

@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <strings.h> #include <strings.h>
#include <byteswap.h> #include <byteswap.h>
#include <errno.h> #include <errno.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include <ipxe/uri.h> #include <ipxe/uri.h>
#include <ipxe/refcnt.h> #include <ipxe/refcnt.h>
@ -441,7 +442,7 @@ static int http_rx_content_length ( struct http_request *http, char *value ) {
/* Parse content length */ /* Parse content length */
content_len = strtoul ( value, &endp, 10 ); content_len = strtoul ( value, &endp, 10 );
if ( *endp != '\0' ) { if ( ! ( ( *endp == '\0' ) || isspace ( *endp ) ) ) {
DBGC ( http, "HTTP %p invalid Content-Length \"%s\"\n", DBGC ( http, "HTTP %p invalid Content-Length \"%s\"\n",
http, value ); http, value );
return -EINVAL_CONTENT_LENGTH; return -EINVAL_CONTENT_LENGTH;