[http] GET / if URI doesn't contain a path
authorJoshua Oreman <oremanj@rwcr.net>
Wed, 27 Jan 2010 04:56:42 +0000 (23:56 -0500)
committerMarty Connor <mdc@etherboot.org>
Wed, 27 Jan 2010 13:52:39 +0000 (08:52 -0500)
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>
src/net/tcp/http.c

index 807a0c3..a365b2a 100644 (file)
@@ -452,11 +452,12 @@ static void http_step ( struct process *process ) {
 
                /* Send GET request */
                if ( ( rc = xfer_printf ( &http->socket,
-                                         "GET %s HTTP/1.0\r\n"
+                                         "GET %s%s HTTP/1.0\r\n"
                                          "User-Agent: gPXE/" VERSION "\r\n"
                                          "%s%s%s"
                                          "Host: %s\r\n"
                                          "\r\n",
+                                         http->uri->path ? "" : "/",
                                          request,
                                          ( user ?
                                            "Authorization: Basic " : "" ),