diff options
author | Nagaraj Hegde <nagaraj-p.hegde@hpe.com> | 2016-04-04 18:09:28 +0800 |
---|---|---|
committer | Fu Siyuan <siyuan.fu@intel.com> | 2016-04-27 10:43:18 +0800 |
commit | 19c25725606b848986f29bb3a216857146fdacb9 (patch) | |
tree | 56396ecae9b2c2cbafb4f9ee8b5e2395f745a68f /NetworkPkg | |
parent | e297a0a498139cedca232aff69c41c8996151f0b (diff) | |
download | edk2-19c25725606b848986f29bb3a216857146fdacb9.tar.gz edk2-19c25725606b848986f29bb3a216857146fdacb9.tar.bz2 edk2-19c25725606b848986f29bb3a216857146fdacb9.zip |
NetworkPkg:HttpDxe:Consume DxeHttpLib API changes
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>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/HttpDxe/HttpImpl.c | 15 | ||||
-rw-r--r-- | NetworkPkg/HttpDxe/HttpProto.c | 14 | ||||
-rw-r--r-- | NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c | 9 |
3 files changed, 17 insertions, 21 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index 63b683e7e5..553b79cca0 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -240,12 +240,13 @@ EfiHttpRequest ( HTTP_PROTOCOL *HttpInstance;
BOOLEAN Configure;
BOOLEAN ReConfigure;
- CHAR8 *RequestStr;
+ CHAR8 *RequestMsg;
CHAR8 *Url;
UINTN UrlLen;
CHAR16 *HostNameStr;
HTTP_TOKEN_WRAP *Wrap;
CHAR8 *FileUrl;
+ UINTN RequestMsgSize;
if ((This == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -314,7 +315,7 @@ EfiHttpRequest ( goto Error1;
}
- RequestStr = NULL;
+ RequestMsg = NULL;
HostName = NULL;
Status = HttpUrlGetHostName (Url, UrlParser, &HostName);
if (EFI_ERROR (Status)) {
@@ -498,7 +499,7 @@ EfiHttpRequest ( }
}
- Status = HttpGenRequestString (HttpMsg, FileUrl, &RequestStr);
+ Status = HttpGenRequestMessage (HttpMsg, FileUrl, &RequestMsg, &RequestMsgSize);
if (EFI_ERROR (Status)) {
goto Error3;
@@ -515,8 +516,8 @@ EfiHttpRequest ( Status = HttpTransmitTcp (
HttpInstance,
Wrap,
- (UINT8*) RequestStr,
- AsciiStrLen (RequestStr)
+ (UINT8*) RequestMsg,
+ RequestMsgSize
);
if (EFI_ERROR (Status)) {
goto Error5;
@@ -534,8 +535,8 @@ Error5: NetMapRemoveTail (&HttpInstance->TxTokens, NULL);
Error4:
- if (RequestStr != NULL) {
- FreePool (RequestStr);
+ if (RequestMsg != NULL) {
+ FreePool (RequestMsg);
}
Error3:
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 156f138f56..9b3c774ae2 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1462,8 +1462,9 @@ HttpTcpTransmit ( {
HTTP_TOKEN_WRAP *ValueInItem;
EFI_STATUS Status;
- CHAR8 *RequestStr;
+ CHAR8 *RequestMsg;
CHAR8 *Url;
+ UINTN RequestMsgSize;
ValueInItem = (HTTP_TOKEN_WRAP *) Item->Value;
if (ValueInItem->TcpWrap.IsTxDone) {
@@ -1483,10 +1484,11 @@ HttpTcpTransmit ( //
// Create request message.
//
- Status = HttpGenRequestString (
+ Status = HttpGenRequestMessage (
ValueInItem->HttpToken->Message,
Url,
- &RequestStr
+ &RequestMsg,
+ &RequestMsgSize
);
FreePool (Url);
@@ -1500,10 +1502,10 @@ HttpTcpTransmit ( Status = HttpTransmitTcp (
ValueInItem->HttpInstance,
ValueInItem,
- (UINT8*) RequestStr,
- AsciiStrLen (RequestStr)
+ (UINT8*) RequestMsg,
+ RequestMsgSize
);
- FreePool (RequestStr);
+ FreePool (RequestMsg);
return Status;
}
diff --git a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c index 739d3b753c..645fca4084 100644 --- a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c +++ b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c @@ -207,11 +207,6 @@ HttpUtilitiesBuild ( StrLength = sizeof("\r\n") - 1;
*NewMessageSize += StrLength;
- //
- // Final 0 for end flag
- //
- *NewMessageSize += 1;
-
*NewMessage = AllocateZeroPool (*NewMessageSize);
if (*NewMessage == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -243,9 +238,7 @@ HttpUtilitiesBuild ( CopyMem (NewMessagePtr, "\r\n", StrLength);
NewMessagePtr += StrLength;
- *NewMessagePtr = 0;
-
- ASSERT (*NewMessageSize == (UINTN)NewMessagePtr - (UINTN)(*NewMessage) + 1);
+ ASSERT (*NewMessageSize == (UINTN)NewMessagePtr - (UINTN)(*NewMessage));
//
// Free allocated buffer
|