]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootClient.c
NetworkPkg: Use Http11 definitions in HttpDxe and HttpBootDxe
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootClient.c
index a2cad0a6fba407b6c51a327af3d08a56bfdc6bfd..2ccac8c842073e16c2697ce6dcf3759370e8e554 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Implementation of the boot file download function.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -717,10 +718,11 @@ HttpBootGetBootFile (
   )\r
 {\r
   EFI_STATUS                 Status;\r
+  EFI_HTTP_STATUS_CODE       StatusCode;\r
   CHAR8                      *HostName;\r
   EFI_HTTP_REQUEST_DATA      *RequestData;\r
-  HTTP_IO_RESOPNSE_DATA      *ResponseData;\r
-  HTTP_IO_RESOPNSE_DATA      ResponseBody;\r
+  HTTP_IO_RESPONSE_DATA      *ResponseData;\r
+  HTTP_IO_RESPONSE_DATA      ResponseBody;\r
   HTTP_IO                    *HttpIo;\r
   HTTP_IO_HEADER             *HttpIoHeader;\r
   VOID                       *Parser;\r
@@ -806,7 +808,7 @@ HttpBootGetBootFile (
   }\r
   Status = HttpBootSetHeader (\r
              HttpIoHeader,\r
-             HTTP_FIELD_NAME_HOST,\r
+             HTTP_HEADER_HOST,\r
              HostName\r
              );\r
   FreePool (HostName);\r
@@ -819,7 +821,7 @@ HttpBootGetBootFile (
   //\r
   Status = HttpBootSetHeader (\r
              HttpIoHeader,\r
-             HTTP_FIELD_NAME_ACCEPT,\r
+             HTTP_HEADER_ACCEPT,\r
              "*/*"\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -831,7 +833,7 @@ HttpBootGetBootFile (
   //\r
   Status = HttpBootSetHeader (\r
              HttpIoHeader,\r
-             HTTP_FIELD_NAME_USER_AGENT,\r
+             HTTP_HEADER_USER_AGENT,\r
              HTTP_USER_AGENT_EFI_HTTP_BOOT\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -884,7 +886,7 @@ HttpBootGetBootFile (
   //\r
   // 3.1 First step, use zero BodyLength to only receive the response headers.\r
   //\r
-  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESOPNSE_DATA));\r
+  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESPONSE_DATA));\r
   if (ResponseData == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ERROR_4;\r
@@ -894,7 +896,12 @@ HttpBootGetBootFile (
              TRUE,\r
              ResponseData\r
              );\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || EFI_ERROR (ResponseData->Status)) {\r
+    if (EFI_ERROR (ResponseData->Status)) {\r
+      StatusCode = HttpIo->RspToken.Message->Data.Response->StatusCode;\r
+      HttpBootPrintErrorMessage (StatusCode);\r
+      Status = ResponseData->Status;\r
+    }\r
     goto ERROR_5;\r
   }\r
 \r
@@ -948,7 +955,7 @@ HttpBootGetBootFile (
     // 3.4.2, start the message-body download, the identity and chunked transfer-coding\r
     // is handled in different path here.\r
     //\r
-    ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESOPNSE_DATA));\r
+    ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESPONSE_DATA));\r
     if (IdentityMode) {\r
       //\r
       // In identity transfer-coding there is no need to parse the message body,\r