]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Use Http11 definitions in HttpDxe and HttpBootDxe
authorSamer El-Haj-Mahmoud <samer.el-haj-mahmoud@hpe.com>
Thu, 18 Feb 2016 22:47:36 +0000 (06:47 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Thu, 25 Feb 2016 07:02:31 +0000 (15:02 +0800)
Change HttpDxe and HttpBootDxe to use the standard definitions from
Http11.h instead of private duplicate definitions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
NetworkPkg/HttpBootDxe/HttpBootClient.c
NetworkPkg/HttpBootDxe/HttpBootClient.h
NetworkPkg/HttpBootDxe/HttpBootDxe.h
NetworkPkg/HttpDxe/HttpDriver.h
NetworkPkg/HttpDxe/HttpImpl.h
NetworkPkg/HttpDxe/HttpProto.c

index dd835c4f833a75e64dfe860c070e0fffa50f099c..2ccac8c842073e16c2697ce6dcf3759370e8e554 100644 (file)
@@ -2,6 +2,7 @@
   Implementation of the boot file download function.\r
 \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
@@ -807,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
@@ -820,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
@@ -832,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
index e618316f10e67e575faec3021d0ddd2040035d90..b929fa7dc29329daee69b94ecc5f6d882f4dd718 100644 (file)
@@ -2,6 +2,7 @@
   Declaration of the boot file download function.\r
 \r
 Copyright (c) 2015, 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
@@ -18,9 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define HTTP_BOOT_REQUEST_TIMEOUT            5000      // 5 seconds in uints of millisecond.\r
 #define HTTP_BOOT_BLOCK_SIZE                 1500\r
 \r
-#define HTTP_FIELD_NAME_USER_AGENT           "User-Agent"\r
-#define HTTP_FIELD_NAME_HOST                 "Host"\r
-#define HTTP_FIELD_NAME_ACCEPT               "Accept"\r
 \r
 \r
 #define HTTP_USER_AGENT_EFI_HTTP_BOOT        "UefiHttpBoot/1.0"\r
index 452c8f4906db386ea896301a869d2cef01b9a93e..08f88c5606a008edbdd4eadf73428ad8c392e0ef 100644 (file)
@@ -2,6 +2,7 @@
   UEFI HTTP boot driver's private data structure and interfaces declaration.\r
 \r
 Copyright (c) 2015, 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
@@ -17,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Uefi.h>\r
 \r
+#include <IndustryStandard/Http11.h>\r
+\r
 //\r
 // Libraries\r
 //\r
index 138f56c9ecd498e375f77e75fb75f2f596212cd4..9c0002abab584702684d0f9db245837d51d34816 100644 (file)
@@ -2,6 +2,7 @@
   The header files of the driver binding and service binding protocol for HttpDxe driver.\r
 \r
   Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -17,6 +18,7 @@
 #define __EFI_HTTP_DRIVER_H__\r
 \r
 #include <Uefi.h>\r
+#include <IndustryStandard/Http11.h>\r
 \r
 //\r
 // Libraries\r
index 38228425bb5092b3c39e5ee2164798aaecdc52e4..415b5e5e95c0813737717d4ab651b48c65614945 100644 (file)
@@ -2,6 +2,7 @@
   The header files of implementation of EFI_HTTP_PROTOCOL protocol interfaces.\r
 \r
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  \r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #define HTTP_DEFAULT_PORT        80\r
 #define HTTP_END_OF_HDR_STR      "\r\n\r\n"\r
 #define HTTP_CRLF_STR            "\r\n"\r
-#define HTTP_VERSION_STR         "HTTP/1.1"\r
+#define HTTP_VERSION_STR         HTTP_VERSION\r
 #define HTTP_VERSION_CRLF_STR    " HTTP/1.1\r\n"\r
-#define HTTP_GET_STR             "GET "\r
-#define HTTP_HEAD_STR            "HEAD "\r
 #define HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE         300\r
 \r
-//\r
-// Connect method has maximum length according to EFI_HTTP_METHOD defined in\r
-// UEFI2.5 spec so use this.\r
-//\r
-#define HTTP_MAXIMUM_METHOD_LEN  sizeof ("CONNECT")\r
 \r
 /**\r
   Returns the operational parameters for the current HTTP child instance.\r
index 9660b6fb67162afd99bfbbb4a6121f8d2431eaf3..579b9e46627070e26ab1f990df973c36f573e4f8 100644 (file)
@@ -2,7 +2,7 @@
   Miscellaneous routines for HttpDxe driver.\r
 \r
 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -2023,7 +2023,7 @@ HttpGenRequestString (
   //\r
   // Calculate HTTP message length.\r
   //\r
-  MsgSize = Message->BodyLength + HTTP_MAXIMUM_METHOD_LEN + AsciiStrLen (Url) + \r
+  MsgSize = Message->BodyLength + HTTP_METHOD_MAXIMUM_LEN + AsciiStrLen (Url) +\r
             AsciiStrLen (HTTP_VERSION_CRLF_STR) + HttpHdrSize;\r
   Request = AllocateZeroPool (MsgSize);\r
   if (Request == NULL) {\r
@@ -2036,13 +2036,13 @@ HttpGenRequestString (
   //\r
   switch (Message->Data.Request->Method) {\r
   case HttpMethodGet:\r
-    StrLength = sizeof (HTTP_GET_STR) - 1;\r
-    CopyMem (RequestPtr, HTTP_GET_STR, StrLength);\r
+    StrLength = sizeof (HTTP_METHOD_GET) - 1;\r
+    CopyMem (RequestPtr, HTTP_METHOD_GET, StrLength);\r
     RequestPtr += StrLength;\r
     break;\r
   case HttpMethodHead:\r
-    StrLength = sizeof (HTTP_HEAD_STR) - 1;\r
-    CopyMem (RequestPtr, HTTP_HEAD_STR, StrLength);\r
+    StrLength = sizeof (HTTP_METHOD_HEAD) - 1;\r
+    CopyMem (RequestPtr, HTTP_METHOD_HEAD, StrLength);\r
     RequestPtr += StrLength;\r
     break;\r
   default:\r
@@ -2050,6 +2050,10 @@ HttpGenRequestString (
     goto Exit;\r
   }\r
 \r
+  StrLength = AsciiStrLen(" ");\r
+  CopyMem (RequestPtr, " ", StrLength);\r
+  RequestPtr += StrLength;\r
+\r
   StrLength = AsciiStrLen (Url);\r
   CopyMem (RequestPtr, Url, StrLength);\r
   RequestPtr += StrLength;\r