NetworkPkg: Avoid memory allocation for each HTTP message exchange.

This patch updates the HTTP driver to use a shared buffer for URL parsing to
avoid memory allocation for each HTTP request.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18449 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Fu Siyuan
2015-09-14 09:05:49 +00:00
committed by sfu5
parent 7fd71047a6
commit 51b0450e00
3 changed files with 25 additions and 9 deletions

View File

@@ -431,6 +431,12 @@ HttpInitProtocol (
goto ON_ERROR;
}
HttpInstance->Url = AllocateZeroPool (HTTP_URL_BUFFER_LEN);
if (HttpInstance->Url == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
}
NetMapInit (&HttpInstance->TxTokens);
NetMapInit (&HttpInstance->RxTokens);
@@ -496,6 +502,11 @@ HttpCleanProtocol (
HttpInstance->MsgParser = NULL;
}
if (HttpInstance->Url != NULL) {
FreePool (HttpInstance->Url);
HttpInstance->Url = NULL;
}
NetMapClean (&HttpInstance->TxTokens);
NetMapClean (&HttpInstance->RxTokens);