Bladeren bron

[http] Accept headers with no whitespace following the colon

Reported-by: Raphael Cohn <raphael.cohn@stormmq.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 jaren geleden
bovenliggende
commit
b42e71921f
1 gewijzigde bestanden met toevoegingen van 6 en 2 verwijderingen
  1. 6
    2
      src/net/tcp/httpcore.c

+ 6
- 2
src/net/tcp/httpcore.c Bestand weergeven

@@ -1201,13 +1201,17 @@ static int http_parse_header ( struct http_transaction *http, char *line ) {
1201 1201
 	DBGC2 ( http, "HTTP %p RX %s\n", http, line );
1202 1202
 
1203 1203
 	/* Extract header name */
1204
-	sep = strstr ( line, ": " );
1204
+	sep = strchr ( line, ':' );
1205 1205
 	if ( ! sep ) {
1206 1206
 		DBGC ( http, "HTTP %p malformed header \"%s\"\n", http, line );
1207 1207
 		return -EINVAL_HEADER;
1208 1208
 	}
1209 1209
 	*sep = '\0';
1210
-	line = ( sep + 2 /* ": " */ );
1210
+
1211
+	/* Extract remainder of line */
1212
+	line = ( sep + 1 );
1213
+	while ( isspace ( *line ) )
1214
+		line++;
1211 1215
 
1212 1216
 	/* Process header, if recognised */
1213 1217
 	for_each_table_entry ( header, HTTP_RESPONSE_HEADERS ) {

Laden…
Annuleren
Opslaan