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 <el...@hpe.com>
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c |  7 ++++---
 NetworkPkg/HttpBootDxe/HttpBootClient.h |  4 +---
 NetworkPkg/HttpBootDxe/HttpBootDxe.h    |  3 +++
 NetworkPkg/HttpDxe/HttpDriver.h         |  2 ++
 NetworkPkg/HttpDxe/HttpImpl.h           | 10 ++--------
 NetworkPkg/HttpDxe/HttpProto.c          | 16 ++++++++++------
 6 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index dd835c4..2ccac8c 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -2,6 +2,7 @@
   Implementation of the boot file download function.
 
 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -807,7 +808,7 @@ HttpBootGetBootFile (
   }
   Status = HttpBootSetHeader (
              HttpIoHeader,
-             HTTP_FIELD_NAME_HOST,
+             HTTP_HEADER_HOST,
              HostName
              );
   FreePool (HostName);
@@ -820,7 +821,7 @@ HttpBootGetBootFile (
   //
   Status = HttpBootSetHeader (
              HttpIoHeader,
-             HTTP_FIELD_NAME_ACCEPT,
+             HTTP_HEADER_ACCEPT,
              "*/*"
              );
   if (EFI_ERROR (Status)) {
@@ -832,7 +833,7 @@ HttpBootGetBootFile (
   //
   Status = HttpBootSetHeader (
              HttpIoHeader,
-             HTTP_FIELD_NAME_USER_AGENT,
+             HTTP_HEADER_USER_AGENT,
              HTTP_USER_AGENT_EFI_HTTP_BOOT
              );
   if (EFI_ERROR (Status)) {
diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h 
b/NetworkPkg/HttpBootDxe/HttpBootClient.h
index e618316..b929fa7 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h
@@ -2,6 +2,7 @@
   Declaration of the boot file download function.
 
 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -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.
 #define HTTP_BOOT_BLOCK_SIZE                 1500
 
-#define HTTP_FIELD_NAME_USER_AGENT           "User-Agent"
-#define HTTP_FIELD_NAME_HOST                 "Host"
-#define HTTP_FIELD_NAME_ACCEPT               "Accept"
 
 
 #define HTTP_USER_AGENT_EFI_HTTP_BOOT        "UefiHttpBoot/1.0"
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h 
b/NetworkPkg/HttpBootDxe/HttpBootDxe.h
index 452c8f4..08f88c5 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h
@@ -2,6 +2,7 @@
   UEFI HTTP boot driver's private data structure and interfaces declaration.
 
 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -17,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 #include <Uefi.h>
 
+#include <IndustryStandard/Http11.h>
+
 //
 // Libraries
 //
diff --git a/NetworkPkg/HttpDxe/HttpDriver.h b/NetworkPkg/HttpDxe/HttpDriver.h
index 138f56c..9c0002a 100644
--- a/NetworkPkg/HttpDxe/HttpDriver.h
+++ b/NetworkPkg/HttpDxe/HttpDriver.h
@@ -2,6 +2,7 @@
   The header files of the driver binding and service binding protocol for 
HttpDxe driver.
 
   Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -17,6 +18,7 @@
 #define __EFI_HTTP_DRIVER_H__
 
 #include <Uefi.h>
+#include <IndustryStandard/Http11.h>
 
 //
 // Libraries
diff --git a/NetworkPkg/HttpDxe/HttpImpl.h b/NetworkPkg/HttpDxe/HttpImpl.h
index 3822842..415b5e5 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.h
+++ b/NetworkPkg/HttpDxe/HttpImpl.h
@@ -2,6 +2,7 @@
   The header files of implementation of EFI_HTTP_PROTOCOL protocol interfaces.
 
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -19,17 +20,10 @@
 #define HTTP_DEFAULT_PORT        80
 #define HTTP_END_OF_HDR_STR      "\r\n\r\n"
 #define HTTP_CRLF_STR            "\r\n"
-#define HTTP_VERSION_STR         "HTTP/1.1"
+#define HTTP_VERSION_STR         HTTP_VERSION
 #define HTTP_VERSION_CRLF_STR    " HTTP/1.1\r\n"
-#define HTTP_GET_STR             "GET "
-#define HTTP_HEAD_STR            "HEAD "
 #define HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE         300
 
-//
-// Connect method has maximum length according to EFI_HTTP_METHOD defined in
-// UEFI2.5 spec so use this.
-//
-#define HTTP_MAXIMUM_METHOD_LEN  sizeof ("CONNECT")
 
 /**
   Returns the operational parameters for the current HTTP child instance.
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 9660b6f..579b9e4 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -2,7 +2,7 @@
   Miscellaneous routines for HttpDxe driver.
 
 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -2023,7 +2023,7 @@ HttpGenRequestString (
   //
   // Calculate HTTP message length.
   //
-  MsgSize = Message->BodyLength + HTTP_MAXIMUM_METHOD_LEN + AsciiStrLen (Url) 
+ 
+  MsgSize = Message->BodyLength + HTTP_METHOD_MAXIMUM_LEN + AsciiStrLen (Url) +
             AsciiStrLen (HTTP_VERSION_CRLF_STR) + HttpHdrSize;
   Request = AllocateZeroPool (MsgSize);
   if (Request == NULL) {
@@ -2036,13 +2036,13 @@ HttpGenRequestString (
   //
   switch (Message->Data.Request->Method) {
   case HttpMethodGet:
-    StrLength = sizeof (HTTP_GET_STR) - 1;
-    CopyMem (RequestPtr, HTTP_GET_STR, StrLength);
+    StrLength = sizeof (HTTP_METHOD_GET) - 1;
+    CopyMem (RequestPtr, HTTP_METHOD_GET, StrLength);
     RequestPtr += StrLength;
     break;
   case HttpMethodHead:
-    StrLength = sizeof (HTTP_HEAD_STR) - 1;
-    CopyMem (RequestPtr, HTTP_HEAD_STR, StrLength);
+    StrLength = sizeof (HTTP_METHOD_HEAD) - 1;
+    CopyMem (RequestPtr, HTTP_METHOD_HEAD, StrLength);
     RequestPtr += StrLength;
     break;
   default:
@@ -2050,6 +2050,10 @@ HttpGenRequestString (
     goto Exit;
   }
 
+  StrLength = AsciiStrLen(" ");
+  CopyMem (RequestPtr, " ", StrLength);
+  RequestPtr += StrLength;
+
   StrLength = AsciiStrLen (Url);
   CopyMem (RequestPtr, Url, StrLength);
   RequestPtr += StrLength;
-- 
2.6.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to