]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg: Making the HTTP IO timeout value programmable with PCD
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpImpl.c
index 5a6ecbc9d982c1db09c96ddeb61c04220a00ca1b..8790e9b4e04a6ffbda90fb47a1eeebb6a60f4e35 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of EFI_HTTP_PROTOCOL protocol interfaces.\r
 \r
-  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
@@ -983,6 +983,7 @@ HttpResponseWorker (
   HTTP_TOKEN_WRAP               *ValueInItem;\r
   UINTN                         HdrLen;\r
   NET_FRAGMENT                  Fragment;\r
+  UINT32                        TimeoutValue;\r
 \r
   if (Wrap == NULL || Wrap->HttpInstance == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -1052,10 +1053,15 @@ HttpResponseWorker (
       }\r
     }\r
 \r
+    //\r
+    // Get HTTP timeout value\r
+    //\r
+    TimeoutValue = PcdGet32 (PcdHttpIoTimeout);\r
+\r
     //\r
     // Start the timer, and wait Timeout seconds to receive the header packet.\r
     //\r
-    Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);\r
+    Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, TimeoutValue * TICKS_PER_MS);\r
     if (EFI_ERROR (Status)) {\r
       goto Error;\r
     }\r
@@ -1329,10 +1335,15 @@ HttpResponseWorker (
       }\r
     }\r
 \r
+    //\r
+    // Get HTTP timeout value\r
+    //\r
+    TimeoutValue = PcdGet32 (PcdHttpIoTimeout);\r
+\r
     //\r
     // Start the timer, and wait Timeout seconds to receive the body packet.\r
     //\r
-    Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);\r
+    Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, TimeoutValue * TICKS_PER_MS);\r
     if (EFI_ERROR (Status)) {\r
       goto Error2;\r
     }\r