]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootClient.c
NetworkPkg/DxeHttpLib: Migrate HTTP header manipulation APIs
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootClient.c
index 68f5a49bad9ab609a3b6f34209b5cfd940c46ff3..8f21f7766ed1fe34bd585455cfd184374f33bda5 100644 (file)
@@ -1,29 +1,23 @@
 /** @file\r
   Implementation of the boot file download function.\r
 \r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, 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
-http://opensource.org/licenses/bsd-license.php.                                          \r
-    \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include "HttpBootDxe.h"\r
 \r
 /**\r
-  Update the IP and URL device path node to include the boot resource information.\r
+  Update the device path node to include the boot resource information.\r
 \r
   @param[in]    Private            The pointer to the driver's private data.\r
 \r
   @retval EFI_SUCCESS              Device patch successfully updated.\r
   @retval EFI_OUT_OF_RESOURCES     Could not allocate needed resources.\r
   @retval Others                   Unexpected error happened.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 HttpBootUpdateDevicePath (\r
@@ -31,13 +25,15 @@ HttpBootUpdateDevicePath (
   )\r
 {\r
   EFI_DEV_PATH               *Node;\r
-  EFI_DEVICE_PATH_PROTOCOL   *TmpDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL   *TmpIpDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL   *TmpDnsDevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL   *NewDevicePath;\r
   UINTN                      Length;\r
   EFI_STATUS                 Status;\r
 \r
-  TmpDevicePath = NULL;\r
-  \r
+  TmpIpDevicePath  = NULL;\r
+  TmpDnsDevicePath = NULL;\r
+\r
   //\r
   // Update the IP node with DHCP assigned information.\r
   //\r
@@ -65,36 +61,72 @@ HttpBootUpdateDevicePath (
     SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));\r
     Node->Ipv6.PrefixLength    = IP6_PREFIX_LENGTH;\r
     Node->Ipv6.RemotePort      = Private->Port;\r
-    Node->Ipv6.Protocol        = EFI_IP_PROTO_TCP; \r
+    Node->Ipv6.Protocol        = EFI_IP_PROTO_TCP;\r
     Node->Ipv6.IpAddressOrigin = 0;\r
     CopyMem (&Node->Ipv6.LocalIpAddress, &Private->StationIp.v6, sizeof (EFI_IPv6_ADDRESS));\r
     CopyMem (&Node->Ipv6.RemoteIpAddress, &Private->ServerIp.v6, sizeof (EFI_IPv6_ADDRESS));\r
     CopyMem (&Node->Ipv6.GatewayIpAddress, &Private->GatewayIp.v6, sizeof (EFI_IPv6_ADDRESS));\r
   }\r
-  \r
-  TmpDevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
+\r
+  TmpIpDevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
   FreePool (Node);\r
-  if (TmpDevicePath == NULL) {\r
+  if (TmpIpDevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
+  //\r
+  // Update the DNS node with DNS server IP list if existed.\r
+  //\r
+  if (Private->DnsServerIp != NULL) {\r
+    Length = sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (Node->Dns.IsIPv6) + Private->DnsServerCount * sizeof (EFI_IP_ADDRESS);\r
+    Node = AllocatePool (Length);\r
+    if (Node == NULL) {\r
+      FreePool (TmpIpDevicePath);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    Node->DevPath.Type    = MESSAGING_DEVICE_PATH;\r
+    Node->DevPath.SubType = MSG_DNS_DP;\r
+    SetDevicePathNodeLength (Node, Length);\r
+    Node->Dns.IsIPv6 = Private->UsingIpv6 ? 0x01 : 0x00;\r
+    CopyMem ((UINT8*) Node + sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (Node->Dns.IsIPv6), Private->DnsServerIp, Private->DnsServerCount * sizeof (EFI_IP_ADDRESS));\r
+\r
+    TmpDnsDevicePath = AppendDevicePathNode (TmpIpDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
+    FreePool (Node);\r
+    FreePool (TmpIpDevicePath);\r
+    TmpIpDevicePath = NULL;\r
+    if (TmpDnsDevicePath == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+  }\r
+\r
   //\r
   // Update the URI node with the boot file URI.\r
   //\r
   Length = sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (Private->BootFileUri);\r
   Node = AllocatePool (Length);\r
   if (Node == NULL) {\r
-    FreePool (TmpDevicePath);\r
+    if (TmpIpDevicePath != NULL) {\r
+      FreePool (TmpIpDevicePath);\r
+    }\r
+    if (TmpDnsDevicePath != NULL) {\r
+      FreePool (TmpDnsDevicePath);\r
+    }\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   Node->DevPath.Type    = MESSAGING_DEVICE_PATH;\r
   Node->DevPath.SubType = MSG_URI_DP;\r
   SetDevicePathNodeLength (Node, Length);\r
   CopyMem ((UINT8*) Node + sizeof (EFI_DEVICE_PATH_PROTOCOL), Private->BootFileUri, AsciiStrSize (Private->BootFileUri));\r
-  \r
-  NewDevicePath = AppendDevicePathNode (TmpDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
+\r
+  if (TmpDnsDevicePath != NULL) {\r
+    NewDevicePath = AppendDevicePathNode (TmpDnsDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
+    FreePool (TmpDnsDevicePath);\r
+  } else {\r
+    ASSERT (TmpIpDevicePath != NULL);\r
+    NewDevicePath = AppendDevicePathNode (TmpIpDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);\r
+    FreePool (TmpIpDevicePath);\r
+  }\r
   FreePool (Node);\r
-  FreePool (TmpDevicePath);\r
   if (NewDevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -112,7 +144,7 @@ HttpBootUpdateDevicePath (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-    \r
+\r
     FreePool (Private->Ip4Nic->DevicePath);\r
     Private->Ip4Nic->DevicePath = NewDevicePath;\r
   } else {\r
@@ -131,7 +163,7 @@ HttpBootUpdateDevicePath (
     FreePool (Private->Ip6Nic->DevicePath);\r
     Private->Ip6Nic->DevicePath = NewDevicePath;\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -153,6 +185,7 @@ HttpBootDhcp4ExtractUriInfo (
   HTTP_BOOT_DHCP4_PACKET_CACHE    *HttpOffer;\r
   UINT32                          SelectIndex;\r
   UINT32                          ProxyIndex;\r
+  UINT32                          DnsServerIndex;\r
   EFI_DHCP4_PACKET_OPTION         *Option;\r
   EFI_STATUS                      Status;\r
 \r
@@ -161,6 +194,8 @@ HttpBootDhcp4ExtractUriInfo (
   SelectIndex = Private->SelectIndex - 1;\r
   ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);\r
 \r
+  DnsServerIndex = 0;\r
+\r
   Status = EFI_SUCCESS;\r
 \r
   //\r
@@ -172,7 +207,7 @@ HttpBootDhcp4ExtractUriInfo (
     //\r
     // In Corporate environment, we need a HttpOffer.\r
     //\r
-    if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) || \r
+    if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||\r
         (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||\r
         (SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns)) {\r
       HttpOffer = SelectOffer;\r
@@ -197,23 +232,45 @@ HttpBootDhcp4ExtractUriInfo (
   Status = HttpBootCheckUriScheme (Private->BootFileUri);\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((EFI_D_ERROR, "HttpBootDhcp4ExtractUriInfo: %r.\n", Status));\r
+    if (Status == EFI_INVALID_PARAMETER) {\r
+      AsciiPrint ("\n  Error: Invalid URI address.\n");\r
+    } else if (Status == EFI_ACCESS_DENIED) {\r
+      AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");\r
+    }\r
     return Status;\r
   }\r
 \r
-  //\r
-  // Configure the default DNS server if server assigned.\r
-  //\r
-  if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) || \r
+  if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||\r
       (SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||\r
       (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {\r
     Option = SelectOffer->OptList[HTTP_BOOT_DHCP4_TAG_INDEX_DNS_SERVER];\r
     ASSERT (Option != NULL);\r
+\r
+    //\r
+    // Record the Dns Server address list.\r
+    //\r
+    Private->DnsServerCount = (Option->Length) / sizeof (EFI_IPv4_ADDRESS);\r
+\r
+    Private->DnsServerIp = AllocateZeroPool (Private->DnsServerCount * sizeof (EFI_IP_ADDRESS));\r
+    if (Private->DnsServerIp == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+\r
+    for (DnsServerIndex = 0; DnsServerIndex < Private->DnsServerCount; DnsServerIndex++) {\r
+      CopyMem (&(Private->DnsServerIp[DnsServerIndex].v4), &(((EFI_IPv4_ADDRESS *) Option->Data)[DnsServerIndex]), sizeof (EFI_IPv4_ADDRESS));\r
+    }\r
+\r
+    //\r
+    // Configure the default DNS server if server assigned.\r
+    //\r
     Status = HttpBootRegisterIp4Dns (\r
                Private,\r
                Option->Length,\r
                Option->Data\r
                );\r
     if (EFI_ERROR (Status)) {\r
+      FreePool (Private->DnsServerIp);\r
+      Private->DnsServerIp = NULL;\r
       return Status;\r
     }\r
   }\r
@@ -229,15 +286,19 @@ HttpBootDhcp4ExtractUriInfo (
   if (EFI_ERROR (Status) || Private->Port == 0) {\r
     Private->Port = 80;\r
   }\r
-  \r
+\r
   //\r
   // All boot informations are valid here.\r
   //\r
 \r
   //\r
-  // Update the device path to include the IP and boot URI information.\r
+  // Update the device path to include the boot resource information.\r
   //\r
   Status = HttpBootUpdateDevicePath (Private);\r
+  if (EFI_ERROR (Status) && Private->DnsServerIp != NULL) {\r
+    FreePool (Private->DnsServerIp);\r
+    Private->DnsServerIp = NULL;\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -260,6 +321,7 @@ HttpBootDhcp6ExtractUriInfo (
   HTTP_BOOT_DHCP6_PACKET_CACHE    *HttpOffer;\r
   UINT32                          SelectIndex;\r
   UINT32                          ProxyIndex;\r
+  UINT32                          DnsServerIndex;\r
   EFI_DHCP6_PACKET_OPTION         *Option;\r
   EFI_IPv6_ADDRESS                IpAddr;\r
   CHAR8                           *HostName;\r
@@ -272,6 +334,8 @@ HttpBootDhcp6ExtractUriInfo (
   SelectIndex = Private->SelectIndex - 1;\r
   ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);\r
 \r
+  DnsServerIndex = 0;\r
+\r
   Status   = EFI_SUCCESS;\r
   HostName = NULL;\r
   //\r
@@ -308,6 +372,11 @@ HttpBootDhcp6ExtractUriInfo (
   Status = HttpBootCheckUriScheme (Private->BootFileUri);\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status));\r
+    if (Status == EFI_INVALID_PARAMETER) {\r
+      AsciiPrint ("\n  Error: Invalid URI address.\n");\r
+    } else if (Status == EFI_ACCESS_DENIED) {\r
+      AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");\r
+    }\r
     return Status;\r
   }\r
 \r
@@ -326,27 +395,42 @@ HttpBootDhcp6ExtractUriInfo (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
-  //\r
-  // Configure the default DNS server if server assigned.\r
-  //\r
-  if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) || \r
+\r
+  if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||\r
       (SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||\r
       (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {\r
     Option = SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER];\r
     ASSERT (Option != NULL);\r
+\r
+    //\r
+    // Record the Dns Server address list.\r
+    //\r
+    Private->DnsServerCount = HTONS (Option->OpLen) / sizeof (EFI_IPv6_ADDRESS);\r
+\r
+    Private->DnsServerIp = AllocateZeroPool (Private->DnsServerCount * sizeof (EFI_IP_ADDRESS));\r
+    if (Private->DnsServerIp == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+\r
+    for (DnsServerIndex = 0; DnsServerIndex < Private->DnsServerCount; DnsServerIndex++) {\r
+      CopyMem (&(Private->DnsServerIp[DnsServerIndex].v6), &(((EFI_IPv6_ADDRESS *) Option->Data)[DnsServerIndex]), sizeof (EFI_IPv6_ADDRESS));\r
+    }\r
+\r
+    //\r
+    // Configure the default DNS server if server assigned.\r
+    //\r
     Status = HttpBootSetIp6Dns (\r
                Private,\r
                HTONS (Option->OpLen),\r
                Option->Data\r
                );\r
     if (EFI_ERROR (Status)) {\r
-      return Status;\r
+      goto Error;\r
     }\r
   }\r
-  \r
+\r
   //\r
-  // Extract the HTTP server Ip frome URL. This is used to Check route table \r
+  // Extract the HTTP server Ip from URL. This is used to Check route table\r
   // whether can send message to HTTP Server Ip through the GateWay.\r
   //\r
   Status = HttpUrlGetIp6 (\r
@@ -354,7 +438,7 @@ HttpBootDhcp6ExtractUriInfo (
              Private->BootFileUriParser,\r
              &IpAddr\r
              );\r
-  \r
+\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // The Http server address is expressed by Name Ip, so perform DNS resolution\r
@@ -365,7 +449,7 @@ HttpBootDhcp6ExtractUriInfo (
                &HostName\r
                );\r
     if (EFI_ERROR (Status)) {\r
-      return Status;\r
+      goto Error;\r
     }\r
 \r
     HostNameSize = AsciiStrSize (HostName);\r
@@ -374,17 +458,23 @@ HttpBootDhcp6ExtractUriInfo (
       Status = EFI_OUT_OF_RESOURCES;\r
       goto Error;\r
     }\r
-    \r
+\r
     AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);\r
+\r
+    if (HostName != NULL) {\r
+      FreePool (HostName);\r
+    }\r
+\r
     Status = HttpBootDns (Private, HostNameStr, &IpAddr);\r
     FreePool (HostNameStr);\r
     if (EFI_ERROR (Status)) {\r
+      AsciiPrint ("\n  Error: Could not retrieve the host address from DNS server.\n");\r
       goto Error;\r
-    }  \r
-  } \r
-  \r
+    }\r
+  }\r
+\r
   CopyMem (&Private->ServerIp.v6, &IpAddr, sizeof (EFI_IPv6_ADDRESS));\r
-  \r
+\r
   //\r
   // Extract the port from URL, and use default HTTP port 80 if not provided.\r
   //\r
@@ -396,22 +486,27 @@ HttpBootDhcp6ExtractUriInfo (
   if (EFI_ERROR (Status) || Private->Port == 0) {\r
     Private->Port = 80;\r
   }\r
-  \r
+\r
   //\r
   // All boot informations are valid here.\r
   //\r
 \r
   //\r
-  // Update the device path to include the IP and boot URI information.\r
+  // Update the device path to include the boot resource information.\r
   //\r
   Status = HttpBootUpdateDevicePath (Private);\r
+  if (EFI_ERROR (Status)) {\r
+    goto Error;\r
+  }\r
+\r
+  return Status;\r
 \r
 Error:\r
-  \r
-  if (HostName != NULL) {\r
-    FreePool (HostName);\r
+  if (Private->DnsServerIp != NULL) {\r
+    FreePool (Private->DnsServerIp);\r
+    Private->DnsServerIp = NULL;\r
   }\r
-    \r
+\r
   return Status;\r
 }\r
 \r
@@ -431,7 +526,7 @@ HttpBootDiscoverBootInfo (
   )\r
 {\r
   EFI_STATUS              Status;\r
-  \r
+\r
   //\r
   // Start D.O.R.A/S.A.R.R exchange to acquire station ip address and\r
   // other Http boot information.\r
@@ -456,7 +551,7 @@ HttpBootDiscoverBootInfo (
   @param[in]    EventType      Indicate the Event type that occurs in the current callback.\r
   @param[in]    Message        HTTP message which will be send to, or just received from HTTP server.\r
   @param[in]    Context        The Callback Context pointer.\r
-  \r
+\r
   @retval EFI_SUCCESS          Tells the HttpIo to continue the HTTP process.\r
   @retval Others               Tells the HttpIo to abort the current HTTP process.\r
 **/\r
@@ -605,7 +700,7 @@ HttpBootFreeCacheList (
   LIST_ENTRY                  *Entry;\r
   LIST_ENTRY                  *NextEntry;\r
   HTTP_BOOT_CACHE_CONTENT     *Cache;\r
-  \r
+\r
   NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->CacheList) {\r
     Cache = NET_LIST_USER_STRUCT (Entry, HTTP_BOOT_CACHE_CONTENT, Link);\r
     RemoveEntryList (&Cache->Link);\r
@@ -645,8 +740,8 @@ HttpBootGetFileFromCache (
   HTTP_BOOT_CACHE_CONTENT     *Cache;\r
   HTTP_BOOT_ENTITY_DATA       *EntityData;\r
   UINTN                       CopyedSize;\r
-  \r
-  if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) {\r
+\r
+  if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -657,8 +752,7 @@ HttpBootGetFileFromCache (
     //\r
     if ((Cache->RequestData != NULL) &&\r
         (Cache->RequestData->Url != NULL) &&\r
-        (StrCmp (Uri, Cache->RequestData->Url) == 0)) \r
-    {\r
+        (StrCmp (Uri, Cache->RequestData->Url) == 0)) {\r
       //\r
       // Hit in cache, record image type.\r
       //\r
@@ -708,7 +802,7 @@ HttpBootGetFileFromCache (
 \r
   @retval EFI_SUCCESS              Continue to parser the message body.\r
   @retval Others                   Abort the parse.\r
\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -778,7 +872,7 @@ HttpBootGetBootFileCallback (
 \r
 /**\r
   This function download the boot file by using UEFI HTTP protocol.\r
-  \r
+\r
   @param[in]       Private         The pointer to the driver's private data.\r
   @param[in]       HeaderOnly      Only request the response header, it could save a lot of time if\r
                                    the caller only want to know the size of the requested file.\r
@@ -826,7 +920,7 @@ HttpBootGetBootFile (
   CHAR16                     *Url;\r
   BOOLEAN                    IdentityMode;\r
   UINTN                      ReceivedSize;\r
-  \r
+\r
   ASSERT (Private != NULL);\r
   ASSERT (Private->HttpCreated);\r
 \r
@@ -847,7 +941,7 @@ HttpBootGetBootFile (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);\r
-  if (!HeaderOnly) {\r
+  if (!HeaderOnly && Buffer != NULL) {\r
     Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);\r
     if (Status != EFI_NOT_FOUND) {\r
       FreePool (Url);\r
@@ -883,7 +977,7 @@ HttpBootGetBootFile (
   //       Accept\r
   //       User-Agent\r
   //\r
-  HttpIoHeader = HttpBootCreateHeader (3);\r
+  HttpIoHeader = HttpIoCreateHeader (3);\r
   if (HttpIoHeader == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ERROR_2;\r
@@ -901,7 +995,7 @@ HttpBootGetBootFile (
   if (EFI_ERROR (Status)) {\r
     goto ERROR_3;\r
   }\r
-  Status = HttpBootSetHeader (\r
+  Status = HttpIoSetHeader (\r
              HttpIoHeader,\r
              HTTP_HEADER_HOST,\r
              HostName\r
@@ -914,7 +1008,7 @@ HttpBootGetBootFile (
   //\r
   // Add HTTP header field 2: Accept\r
   //\r
-  Status = HttpBootSetHeader (\r
+  Status = HttpIoSetHeader (\r
              HttpIoHeader,\r
              HTTP_HEADER_ACCEPT,\r
              "*/*"\r
@@ -926,7 +1020,7 @@ HttpBootGetBootFile (
   //\r
   // Add HTTP header field 3: User-Agent\r
   //\r
-  Status = HttpBootSetHeader (\r
+  Status = HttpIoSetHeader (\r
              HttpIoHeader,\r
              HTTP_HEADER_USER_AGENT,\r
              HTTP_USER_AGENT_EFI_HTTP_BOOT\r
@@ -1016,7 +1110,7 @@ HttpBootGetBootFile (
     Cache->ResponseData = ResponseData;\r
     Cache->ImageType = *ImageType;\r
   }\r
-  \r
+\r
   //\r
   // 3.3 Init a message-body parser from the header information.\r
   //\r
@@ -1029,7 +1123,7 @@ HttpBootGetBootFile (
   Context.Cache      = Cache;\r
   Context.Private    = Private;\r
   Status = HttpInitMsgParser (\r
-             HeaderOnly? HttpMethodHead : HttpMethodGet,\r
+             HeaderOnly ? HttpMethodHead : HttpMethodGet,\r
              ResponseData->Response.StatusCode,\r
              ResponseData->HeaderCount,\r
              ResponseData->Headers,\r
@@ -1178,7 +1272,7 @@ HttpBootGetBootFile (
   }\r
 \r
   return Status;\r
-  \r
+\r
 ERROR_6:\r
   if (Parser != NULL) {\r
     HttpFreeMsgParser (Parser);\r
@@ -1187,7 +1281,7 @@ ERROR_6:
     FreePool (Context.Block);\r
   }\r
   HttpBootFreeCache (Cache);\r
-  \r
+\r
 ERROR_5:\r
   if (ResponseData != NULL) {\r
     FreePool (ResponseData);\r
@@ -1197,7 +1291,7 @@ ERROR_4:
     FreePool (RequestData);\r
   }\r
 ERROR_3:\r
-  HttpBootFreeHeader (HttpIoHeader);\r
+  HttpIoFreeHeader (HttpIoHeader);\r
 ERROR_2:\r
   if (Cache != NULL) {\r
     FreePool (Cache);\r