]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg:HttpDxe:Consume DxeHttpLib API changes
authorNagaraj Hegde <nagaraj-p.hegde@hpe.com>
Mon, 4 Apr 2016 10:09:28 +0000 (18:09 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Wed, 27 Apr 2016 02:43:18 +0000 (10:43 +0800)
HttpGenRequestString is updated to HttpGenRequestMessage,
with an additional argument. This patch updates the caller
of the DxeHttpLib API. Also, we will avoid adding any '\0'
to the string, which was added to make AsciiStrLen to
work on the string.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde <nagaraj-p.hegde@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg/HttpDxe/HttpProto.c
NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c

index 63b683e7e5e25962967091d66310a53a0bd79dc3..553b79cca01aeb35805398e7168fe70c6920a638 100644 (file)
@@ -240,12 +240,13 @@ EfiHttpRequest (
   HTTP_PROTOCOL                 *HttpInstance;\r
   BOOLEAN                       Configure;\r
   BOOLEAN                       ReConfigure;\r
-  CHAR8                         *RequestStr;\r
+  CHAR8                         *RequestMsg;\r
   CHAR8                         *Url;\r
   UINTN                         UrlLen;\r
   CHAR16                        *HostNameStr;\r
   HTTP_TOKEN_WRAP               *Wrap;\r
   CHAR8                         *FileUrl;\r
+  UINTN                         RequestMsgSize;\r
   \r
   if ((This == NULL) || (Token == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -314,7 +315,7 @@ EfiHttpRequest (
     goto Error1;\r
   }\r
 \r
-  RequestStr = NULL;\r
+  RequestMsg = NULL;\r
   HostName   = NULL;\r
   Status     = HttpUrlGetHostName (Url, UrlParser, &HostName);\r
   if (EFI_ERROR (Status)) {\r
@@ -498,7 +499,7 @@ EfiHttpRequest (
     }\r
   }\r
 \r
-  Status = HttpGenRequestString (HttpMsg, FileUrl, &RequestStr);\r
+  Status = HttpGenRequestMessage (HttpMsg, FileUrl, &RequestMsg, &RequestMsgSize);\r
 \r
   if (EFI_ERROR (Status)) {\r
     goto Error3;\r
@@ -515,8 +516,8 @@ EfiHttpRequest (
   Status = HttpTransmitTcp (\r
              HttpInstance,\r
              Wrap,\r
-             (UINT8*) RequestStr,\r
-             AsciiStrLen (RequestStr)\r
+             (UINT8*) RequestMsg,\r
+             RequestMsgSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
     goto Error5;    \r
@@ -534,8 +535,8 @@ Error5:
     NetMapRemoveTail (&HttpInstance->TxTokens, NULL);\r
 \r
 Error4:\r
-  if (RequestStr != NULL) {\r
-    FreePool (RequestStr);\r
+  if (RequestMsg != NULL) {\r
+    FreePool (RequestMsg);\r
   }  \r
 \r
 Error3:\r
index 156f138f56d754163c224b6f8a0cfb049cb87ac3..9b3c774ae21d53feb2987b6e53f8d33617d881b4 100644 (file)
@@ -1462,8 +1462,9 @@ HttpTcpTransmit (
 {\r
   HTTP_TOKEN_WRAP           *ValueInItem;\r
   EFI_STATUS                Status;\r
-  CHAR8                     *RequestStr;\r
+  CHAR8                     *RequestMsg;\r
   CHAR8                     *Url;\r
+  UINTN                     RequestMsgSize;\r
 \r
   ValueInItem = (HTTP_TOKEN_WRAP *) Item->Value;\r
   if (ValueInItem->TcpWrap.IsTxDone) {\r
@@ -1483,10 +1484,11 @@ HttpTcpTransmit (
   //\r
   // Create request message.\r
   //\r
-  Status = HttpGenRequestString (\r
+  Status = HttpGenRequestMessage (\r
                  ValueInItem->HttpToken->Message,\r
                  Url,\r
-                 &RequestStr\r
+                 &RequestMsg,\r
+                 &RequestMsgSize\r
                  );\r
   FreePool (Url);\r
 \r
@@ -1500,10 +1502,10 @@ HttpTcpTransmit (
   Status = HttpTransmitTcp (\r
              ValueInItem->HttpInstance,\r
              ValueInItem,\r
-             (UINT8*) RequestStr,\r
-             AsciiStrLen (RequestStr)\r
+             (UINT8*) RequestMsg,\r
+             RequestMsgSize\r
              );\r
-  FreePool (RequestStr);\r
+  FreePool (RequestMsg);\r
   return Status;\r
 }\r
 \r
index 739d3b753cddd5ca469ed461ca619d8183e0c03e..645fca4084d45aa741c1b82c16bebd3539902fa8 100644 (file)
@@ -207,11 +207,6 @@ HttpUtilitiesBuild (
   StrLength = sizeof("\r\n") - 1;\r
   *NewMessageSize += StrLength;\r
 \r
-  //\r
-  // Final 0 for end flag\r
-  //\r
-  *NewMessageSize += 1; \r
-\r
   *NewMessage = AllocateZeroPool (*NewMessageSize);\r
   if (*NewMessage == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -243,9 +238,7 @@ HttpUtilitiesBuild (
   CopyMem (NewMessagePtr, "\r\n", StrLength);\r
   NewMessagePtr += StrLength;\r
 \r
-  *NewMessagePtr = 0;\r
-\r
-  ASSERT (*NewMessageSize == (UINTN)NewMessagePtr - (UINTN)(*NewMessage) + 1);\r
+  ASSERT (*NewMessageSize == (UINTN)NewMessagePtr - (UINTN)(*NewMessage));\r
 \r
   //\r
   // Free allocated buffer \r