]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg: Use the New Functions from HttpLib
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpImpl.c
index b46f0ae3caef3a848ae5f0259cc72a1de1f54deb..63b683e7e5e25962967091d66310a53a0bd79dc3 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation of EFI_HTTP_PROTOCOL protocol interfaces.\r
 \r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+  Copyright (c) 2015 - 2016, 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
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -497,9 +497,10 @@ EfiHttpRequest (
       goto Error3;\r
     }\r
   }\r
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);\r
-  if (RequestStr == NULL) {\r
-    Status = EFI_OUT_OF_RESOURCES;\r
+\r
+  Status = HttpGenRequestString (HttpMsg, FileUrl, &RequestStr);\r
+\r
+  if (EFI_ERROR (Status)) {\r
     goto Error3;\r
   }\r
 \r
@@ -976,7 +977,7 @@ HttpResponseWorker (
     HttpHeaders = NULL;\r
     \r
     HttpMsg->Data.Response->StatusCode = HttpMappingToStatusCode (StatusCode);\r
-\r
+    HttpInstance->StatusCode = StatusCode;\r
     //\r
     // Init message-body parser by header information.  \r
     //\r
@@ -1111,7 +1112,13 @@ Exit:
   if (Item != NULL) {\r
     NetMapRemoveItem (&Wrap->HttpInstance->RxTokens, Item, NULL);\r
   }\r
-  Token->Status = Status;\r
+\r
+  if (HttpInstance->StatusCode >= HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE) {\r
+    Token->Status = EFI_HTTP_ERROR;\r
+  } else {\r
+    Token->Status = Status;\r
+  }\r
+\r
   gBS->SignalEvent (Token->Event);\r
   HttpCloseTcpRxEvent (Wrap);\r
   FreePool (Wrap);\r
@@ -1136,7 +1143,12 @@ Error:
     HttpInstance->CacheBody = NULL;\r
   }\r
 \r
-  Token->Status = Status;\r
+  if (HttpInstance->StatusCode >= HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE) {\r
+    Token->Status = EFI_HTTP_ERROR;\r
+  } else {\r
+    Token->Status = Status;\r
+  }\r
+\r
   gBS->SignalEvent (Token->Event);\r
 \r
   return Status;  \r