This patch updates the HTTP Boot Configuration page to allow the user to create
a corporate mode HTTP boot option, by leaving the URI string empty.
The patch also fix a bug that the L"https://"; should use StrnCmp() with Length 
8.

Cc: Li Gary <gar...@hpe.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootConfig.c            | 9 +++++----
 NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootConfig.c 
b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
index c47dddc..00e4782 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootConfig.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
@@ -79,9 +79,9 @@ HttpBootAddBootOption (
   }
 
   //
-  // Only accept http and https URI.
+  // Only accept empty URI, or http and https URI.
   //
-  if ((StrnCmp (Uri, L"http://";, 7) != 0) && (StrnCmp (Uri, L"https://";, 7) != 
0)) {
+  if ((StrLen (Uri) != 0) && (StrnCmp (Uri, L"http://";, 7) != 0) && (StrnCmp 
(Uri, L"https://";, 8) != 0)) {
     return EFI_INVALID_PARAMETER;
   }
   
@@ -577,9 +577,10 @@ HttpBootFormCallback (
     HiiSetString (CallbackInfo->RegisteredHandle, Value->string, Uri, NULL);
 
     //
-    // We only accept http and https, pop up a message box for unsupported URI.
+    // The URI should be either an empty string (for corporate environment) 
,or http(s) for home environment.
+    // Pop up a message box for other unsupported URI.
     //
-    if ((StrnCmp (Uri, L"http://";, 7) != 0) && (StrnCmp (Uri, L"https://";, 7) 
!= 0)) {
+    if ((StrLen (Uri) != 0) && (StrnCmp (Uri, L"http://";, 7) != 0) && (StrnCmp 
(Uri, L"https://";, 8) != 0)) {
       CreatePopUp (
         EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
         &Key,
diff --git a/NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h 
b/NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
index 37ce440..682306e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
@@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 //
 // Macros used for an IPv4 or an IPv6 address.
 //
-#define URI_STR_MIN_SIZE             8
+#define URI_STR_MIN_SIZE             0
 #define URI_STR_MAX_SIZE             255
 
 #define DESCRIPTION_STR_MIN_SIZE     6
-- 
2.7.4.windows.1

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

Reply via email to