Browse Source

[http] GET / if URI doesn't contain a path

Commit 3d9dd93 introduced a regression in HTTP: if a URI without a
path is specified (e.g. http://netboot.me), we send the empty string
as our GET request. Reintroduce an extra slash when uri->path is NULL,
to turn this into the expected GET /.

Reported-by: Kyle Kienapfel <doctor.whom@gmail.com>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.0.0
Joshua Oreman 14 years ago
parent
commit
f3467ad169
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/net/tcp/http.c

+ 2
- 1
src/net/tcp/http.c View File

@@ -452,11 +452,12 @@ static void http_step ( struct process *process ) {
452 452
 
453 453
 		/* Send GET request */
454 454
 		if ( ( rc = xfer_printf ( &http->socket,
455
-					  "GET %s HTTP/1.0\r\n"
455
+					  "GET %s%s HTTP/1.0\r\n"
456 456
 					  "User-Agent: gPXE/" VERSION "\r\n"
457 457
 					  "%s%s%s"
458 458
 					  "Host: %s\r\n"
459 459
 					  "\r\n",
460
+					  http->uri->path ? "" : "/",
460 461
 					  request,
461 462
 					  ( user ?
462 463
 					    "Authorization: Basic " : "" ),

Loading…
Cancel
Save