]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg: Add PCD to enable the HTTP connections switch
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpImpl.c
index d19f73348d4931d3058bf6afbbca03e5bd4aed1e..85b00833492e52ebbaabb7bf520d3bff2325e30a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of EFI_HTTP_PROTOCOL protocol interfaces.\r
 \r
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
@@ -354,6 +354,16 @@ EfiHttpRequest (
     //\r
     HttpInstance->UseHttps = IsHttpsUrl (Url);\r
 \r
+    //\r
+    // HTTP is disabled, return directly if the URI is not HTTPS.\r
+    //\r
+    if (!PcdGetBool (PcdAllowHttpConnections) && !(HttpInstance->UseHttps)) {\r
+      \r
+      DEBUG ((EFI_D_ERROR, "EfiHttpRequest: HTTP is disabled.\n"));\r
+\r
+      return EFI_ACCESS_DENIED;\r
+    }\r
+\r
     //\r
     // Check whether we need to create Tls child and open the TLS protocol.\r
     //\r