summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/HttpDxe/HttpImpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'NetworkPkg/HttpDxe/HttpImpl.c')
-rw-r--r--NetworkPkg/HttpDxe/HttpImpl.c291
1 files changed, 147 insertions, 144 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 7024821515..d64cd9e965 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -45,11 +45,11 @@ EFI_HTTP_PROTOCOL mEfiHttpTemplate = {
EFI_STATUS
EFIAPI
EfiHttpGetModeData (
- IN EFI_HTTP_PROTOCOL *This,
- OUT EFI_HTTP_CONFIG_DATA *HttpConfigData
+ IN EFI_HTTP_PROTOCOL *This,
+ OUT EFI_HTTP_CONFIG_DATA *HttpConfigData
)
{
- HTTP_PROTOCOL *HttpInstance;
+ HTTP_PROTOCOL *HttpInstance;
//
// Check input parameters.
@@ -61,7 +61,8 @@ EfiHttpGetModeData (
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
if ((HttpConfigData->AccessPoint.IPv6Node == NULL) ||
- (HttpConfigData->AccessPoint.IPv4Node == NULL)) {
+ (HttpConfigData->AccessPoint.IPv4Node == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -78,7 +79,7 @@ EfiHttpGetModeData (
HttpConfigData->AccessPoint.IPv6Node,
&HttpInstance->Ipv6Node,
sizeof (HttpInstance->Ipv6Node)
- );
+ );
} else {
CopyMem (
HttpConfigData->AccessPoint.IPv4Node,
@@ -124,20 +125,21 @@ EfiHttpGetModeData (
EFI_STATUS
EFIAPI
EfiHttpConfigure (
- IN EFI_HTTP_PROTOCOL *This,
- IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL
+ IN EFI_HTTP_PROTOCOL *This,
+ IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL
)
{
- HTTP_PROTOCOL *HttpInstance;
- EFI_STATUS Status;
+ HTTP_PROTOCOL *HttpInstance;
+ EFI_STATUS Status;
//
// Check input parameters.
//
- if (This == NULL ||
- (HttpConfigData != NULL &&
- ((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) ||
- (!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)))) {
+ if ((This == NULL) ||
+ ((HttpConfigData != NULL) &&
+ ((HttpConfigData->LocalAddressIsIPv6 && (HttpConfigData->AccessPoint.IPv6Node == NULL)) ||
+ (!HttpConfigData->LocalAddressIsIPv6 && (HttpConfigData->AccessPoint.IPv4Node == NULL)))))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -145,7 +147,6 @@ EfiHttpConfigure (
ASSERT (HttpInstance->Service != NULL);
if (HttpConfigData != NULL) {
-
if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {
return EFI_UNSUPPORTED;
}
@@ -185,7 +186,6 @@ EfiHttpConfigure (
HttpInstance->State = HTTP_STATE_HTTP_CONFIGED;
return EFI_SUCCESS;
-
} else {
//
// Reset all the resources related to HttpInstance.
@@ -196,7 +196,6 @@ EfiHttpConfigure (
}
}
-
/**
The Request() function queues an HTTP request to this HTTP instance.
@@ -226,41 +225,41 @@ EfiHttpConfigure (
EFI_STATUS
EFIAPI
EfiHttpRequest (
- IN EFI_HTTP_PROTOCOL *This,
- IN EFI_HTTP_TOKEN *Token
+ IN EFI_HTTP_PROTOCOL *This,
+ IN EFI_HTTP_TOKEN *Token
)
{
- EFI_HTTP_MESSAGE *HttpMsg;
- EFI_HTTP_REQUEST_DATA *Request;
- VOID *UrlParser;
- EFI_STATUS Status;
- CHAR8 *HostName;
- UINTN HostNameSize;
- UINT16 RemotePort;
- HTTP_PROTOCOL *HttpInstance;
- BOOLEAN Configure;
- BOOLEAN ReConfigure;
- BOOLEAN TlsConfigure;
- CHAR8 *RequestMsg;
- CHAR8 *Url;
- UINTN UrlLen;
- CHAR16 *HostNameStr;
- HTTP_TOKEN_WRAP *Wrap;
- CHAR8 *FileUrl;
- UINTN RequestMsgSize;
- EFI_HANDLE ImageHandle;
+ EFI_HTTP_MESSAGE *HttpMsg;
+ EFI_HTTP_REQUEST_DATA *Request;
+ VOID *UrlParser;
+ EFI_STATUS Status;
+ CHAR8 *HostName;
+ UINTN HostNameSize;
+ UINT16 RemotePort;
+ HTTP_PROTOCOL *HttpInstance;
+ BOOLEAN Configure;
+ BOOLEAN ReConfigure;
+ BOOLEAN TlsConfigure;
+ CHAR8 *RequestMsg;
+ CHAR8 *Url;
+ UINTN UrlLen;
+ CHAR16 *HostNameStr;
+ HTTP_TOKEN_WRAP *Wrap;
+ CHAR8 *FileUrl;
+ UINTN RequestMsgSize;
+ EFI_HANDLE ImageHandle;
//
// Initializations
//
- Url = NULL;
- UrlParser = NULL;
- RemotePort = 0;
- HostName = NULL;
- RequestMsg = NULL;
- HostNameStr = NULL;
- Wrap = NULL;
- FileUrl = NULL;
+ Url = NULL;
+ UrlParser = NULL;
+ RemotePort = 0;
+ HostName = NULL;
+ RequestMsg = NULL;
+ HostNameStr = NULL;
+ Wrap = NULL;
+ FileUrl = NULL;
TlsConfigure = FALSE;
if ((This == NULL) || (Token == NULL)) {
@@ -280,7 +279,8 @@ EfiHttpRequest (
if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
(Request->Method != HttpMethodHead) && (Request->Method != HttpMethodDelete) &&
(Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost) &&
- (Request->Method != HttpMethodPatch)) {
+ (Request->Method != HttpMethodPatch))
+ {
return EFI_UNSUPPORTED;
}
@@ -303,7 +303,8 @@ EfiHttpRequest (
//
if ((HttpInstance->Method != HttpMethodPut) &&
(HttpInstance->Method != HttpMethodPost) &&
- (HttpInstance->Method != HttpMethodPatch)) {
+ (HttpInstance->Method != HttpMethodPatch))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -317,7 +318,7 @@ EfiHttpRequest (
//
// We need to have the Message Body for sending the HTTP message across in these cases.
//
- if (HttpMsg->Body == NULL || HttpMsg->BodyLength == 0) {
+ if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -337,18 +338,18 @@ EfiHttpRequest (
//
// Parse the URI of the remote host.
//
- Url = HttpInstance->Url;
+ Url = HttpInstance->Url;
UrlLen = StrLen (Request->Url) + 1;
if (UrlLen > HTTP_URL_BUFFER_LEN) {
Url = AllocateZeroPool (UrlLen);
if (Url == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
FreePool (HttpInstance->Url);
HttpInstance->Url = Url;
}
-
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
//
@@ -361,7 +362,6 @@ EfiHttpRequest (
// HTTP is disabled, return directly if the URI is not HTTPS.
//
if (!PcdGetBool (PcdAllowHttpConnections) && !(HttpInstance->UseHttps)) {
-
DEBUG ((DEBUG_ERROR, "EfiHttpRequest: HTTP is disabled.\n"));
return EFI_ACCESS_DENIED;
@@ -370,7 +370,7 @@ EfiHttpRequest (
//
// Check whether we need to create Tls child and open the TLS protocol.
//
- if (HttpInstance->UseHttps && HttpInstance->TlsChildHandle == NULL) {
+ if (HttpInstance->UseHttps && (HttpInstance->TlsChildHandle == NULL)) {
//
// Use TlsSb to create Tls child and open the TLS protocol.
//
@@ -394,7 +394,7 @@ EfiHttpRequest (
}
UrlParser = NULL;
- Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, &UrlParser);
+ Status = HttpParseUrl (Url, (UINT32)AsciiStrLen (Url), FALSE, &UrlParser);
if (EFI_ERROR (Status)) {
goto Error1;
}
@@ -407,7 +407,7 @@ EfiHttpRequest (
if (HttpInstance->LocalAddressIsIPv6) {
HostNameSize = AsciiStrSize (HostName);
- if (HostNameSize > 2 && HostName[0] == '[' && HostName[HostNameSize - 2] == ']') {
+ if ((HostNameSize > 2) && (HostName[0] == '[') && (HostName[HostNameSize - 2] == ']')) {
//
// HostName format is expressed as IPv6, so, remove '[' and ']'.
//
@@ -425,6 +425,7 @@ EfiHttpRequest (
RemotePort = HTTP_DEFAULT_PORT;
}
}
+
//
// If Configure is TRUE, it indicates the first time to call Request();
// If ReConfigure is TRUE, it indicates the request URL is not same
@@ -443,7 +444,8 @@ EfiHttpRequest (
(AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) &&
(!HttpInstance->UseHttps || (HttpInstance->UseHttps &&
!TlsConfigure &&
- HttpInstance->TlsSessionState == EfiTlsSessionDataTransferring))) {
+ (HttpInstance->TlsSessionState == EfiTlsSessionDataTransferring))))
+ {
//
// Host Name and port number of the request URL are the same with previous call to Request().
// If Https protocol used, the corresponding SessionState is EfiTlsSessionDataTransferring.
@@ -515,7 +517,7 @@ EfiHttpRequest (
if (EFI_ERROR (Status)) {
HostNameSize = AsciiStrSize (HostName);
- HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
+ HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
if (HostNameStr == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error1;
@@ -527,6 +529,7 @@ EfiHttpRequest (
} else {
Status = HttpDns6 (HttpInstance, HostNameStr, &HttpInstance->RemoteIpv6Addr);
}
+
HttpNotify (HttpEventDns, Status);
FreePool (HostNameStr);
@@ -542,7 +545,7 @@ EfiHttpRequest (
ASSERT (HttpInstance->RemoteHost == NULL);
HttpInstance->RemotePort = RemotePort;
HttpInstance->RemoteHost = HostName;
- HostName = NULL;
+ HostName = NULL;
}
if (ReConfigure) {
@@ -577,8 +580,8 @@ EfiHttpRequest (
goto Error1;
}
- Wrap->HttpToken = Token;
- Wrap->HttpInstance = HttpInstance;
+ Wrap->HttpToken = Token;
+ Wrap->HttpInstance = HttpInstance;
if (Request != NULL) {
Wrap->TcpWrap.Method = Request->Method;
}
@@ -608,13 +611,14 @@ EfiHttpRequest (
// Create request message.
//
FileUrl = Url;
- if (Url != NULL && *FileUrl != '/') {
+ if ((Url != NULL) && (*FileUrl != '/')) {
//
// Convert the absolute-URI to the absolute-path
//
while (*FileUrl != ':') {
FileUrl++;
}
+
if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
FileUrl += 3;
while (*FileUrl != '/') {
@@ -628,7 +632,7 @@ EfiHttpRequest (
Status = HttpGenRequestMessage (HttpMsg, FileUrl, &RequestMsg, &RequestMsgSize);
- if (EFI_ERROR (Status) || NULL == RequestMsg) {
+ if (EFI_ERROR (Status) || (NULL == RequestMsg)) {
goto Error3;
}
@@ -651,7 +655,7 @@ EfiHttpRequest (
Status = HttpTransmitTcp (
HttpInstance,
Wrap,
- (UINT8*) RequestMsg,
+ (UINT8 *)RequestMsg,
RequestMsgSize
);
if (EFI_ERROR (Status)) {
@@ -698,6 +702,7 @@ Error2:
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
Wrap->TcpWrap.Tx4Token.CompletionToken.Event = NULL;
}
+
if (NULL != Wrap->TcpWrap.Tx6Token.CompletionToken.Event) {
gBS->CloseEvent (Wrap->TcpWrap.Tx6Token.CompletionToken.Event);
Wrap->TcpWrap.Tx6Token.CompletionToken.Event = NULL;
@@ -707,15 +712,16 @@ Error1:
if (HostName != NULL) {
FreePool (HostName);
}
+
if (Wrap != NULL) {
FreePool (Wrap);
}
+
if (UrlParser != NULL) {
HttpUrlFreeParser (UrlParser);
}
return Status;
-
}
/**
@@ -732,16 +738,16 @@ Error1:
EFI_STATUS
EFIAPI
HttpCancelTokens (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Context
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Context
)
{
- EFI_HTTP_TOKEN *Token;
- HTTP_TOKEN_WRAP *Wrap;
- HTTP_PROTOCOL *HttpInstance;
+ EFI_HTTP_TOKEN *Token;
+ HTTP_TOKEN_WRAP *Wrap;
+ HTTP_PROTOCOL *HttpInstance;
- Token = (EFI_HTTP_TOKEN *) Context;
+ Token = (EFI_HTTP_TOKEN *)Context;
//
// Return EFI_SUCCESS to check the next item in the map if
@@ -751,7 +757,7 @@ HttpCancelTokens (
return EFI_SUCCESS;
}
- Wrap = (HTTP_TOKEN_WRAP *) Item->Value;
+ Wrap = (HTTP_TOKEN_WRAP *)Item->Value;
ASSERT (Wrap != NULL);
HttpInstance = Wrap->HttpInstance;
@@ -808,11 +814,11 @@ HttpCancelTokens (
**/
EFI_STATUS
HttpCancel (
- IN HTTP_PROTOCOL *HttpInstance,
- IN EFI_HTTP_TOKEN *Token
+ IN HTTP_PROTOCOL *HttpInstance,
+ IN EFI_HTTP_TOKEN *Token
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// First check the tokens queued by EfiHttpRequest().
@@ -855,7 +861,6 @@ HttpCancel (
return EFI_SUCCESS;
}
-
/**
Abort an asynchronous HTTP request or response token.
@@ -881,11 +886,11 @@ HttpCancel (
EFI_STATUS
EFIAPI
EfiHttpCancel (
- IN EFI_HTTP_PROTOCOL *This,
- IN EFI_HTTP_TOKEN *Token
+ IN EFI_HTTP_PROTOCOL *This,
+ IN EFI_HTTP_TOKEN *Token
)
{
- HTTP_PROTOCOL *HttpInstance;
+ HTTP_PROTOCOL *HttpInstance;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -898,7 +903,6 @@ EfiHttpCancel (
}
return HttpCancel (HttpInstance, Token);
-
}
/**
@@ -918,28 +922,28 @@ EfiHttpCancel (
EFI_STATUS
EFIAPI
HttpBodyParserCallback (
- IN HTTP_BODY_PARSE_EVENT EventType,
- IN CHAR8 *Data,
- IN UINTN Length,
- IN VOID *Context
+ IN HTTP_BODY_PARSE_EVENT EventType,
+ IN CHAR8 *Data,
+ IN UINTN Length,
+ IN VOID *Context
)
{
- HTTP_CALLBACK_DATA *CallbackData;
- HTTP_TOKEN_WRAP *Wrap;
- UINTN BodyLength;
- CHAR8 *Body;
+ HTTP_CALLBACK_DATA *CallbackData;
+ HTTP_TOKEN_WRAP *Wrap;
+ UINTN BodyLength;
+ CHAR8 *Body;
if (EventType != BodyParseEventOnComplete) {
return EFI_SUCCESS;
}
- if (Data == NULL || Length != 0 || Context == NULL) {
+ if ((Data == NULL) || (Length != 0) || (Context == NULL)) {
return EFI_SUCCESS;
}
- CallbackData = (HTTP_CALLBACK_DATA *) Context;
+ CallbackData = (HTTP_CALLBACK_DATA *)Context;
- Wrap = (HTTP_TOKEN_WRAP *) (CallbackData->Wrap);
+ Wrap = (HTTP_TOKEN_WRAP *)(CallbackData->Wrap);
Body = CallbackData->ParseData;
BodyLength = CallbackData->ParseDataLength;
@@ -965,35 +969,35 @@ HttpBodyParserCallback (
**/
EFI_STATUS
HttpResponseWorker (
- IN HTTP_TOKEN_WRAP *Wrap
+ IN HTTP_TOKEN_WRAP *Wrap
)
{
- EFI_STATUS Status;
- EFI_HTTP_MESSAGE *HttpMsg;
- CHAR8 *EndofHeader;
- CHAR8 *HttpHeaders;
- UINTN SizeofHeaders;
- UINTN BufferSize;
- UINTN StatusCode;
- CHAR8 *Tmp;
- CHAR8 *HeaderTmp;
- CHAR8 *StatusCodeStr;
- UINTN BodyLen;
- HTTP_PROTOCOL *HttpInstance;
- EFI_HTTP_TOKEN *Token;
- NET_MAP_ITEM *Item;
- HTTP_TOKEN_WRAP *ValueInItem;
- UINTN HdrLen;
- NET_FRAGMENT Fragment;
- UINT32 TimeoutValue;
-
- if (Wrap == NULL || Wrap->HttpInstance == NULL) {
+ EFI_STATUS Status;
+ EFI_HTTP_MESSAGE *HttpMsg;
+ CHAR8 *EndofHeader;
+ CHAR8 *HttpHeaders;
+ UINTN SizeofHeaders;
+ UINTN BufferSize;
+ UINTN StatusCode;
+ CHAR8 *Tmp;
+ CHAR8 *HeaderTmp;
+ CHAR8 *StatusCodeStr;
+ UINTN BodyLen;
+ HTTP_PROTOCOL *HttpInstance;
+ EFI_HTTP_TOKEN *Token;
+ NET_MAP_ITEM *Item;
+ HTTP_TOKEN_WRAP *ValueInItem;
+ UINTN HdrLen;
+ NET_FRAGMENT Fragment;
+ UINT32 TimeoutValue;
+
+ if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) {
return EFI_INVALID_PARAMETER;
}
HttpInstance = Wrap->HttpInstance;
- Token = Wrap->HttpToken;
- HttpMsg = Token->Message;
+ Token = Wrap->HttpToken;
+ HttpMsg = Token->Message;
HttpInstance->EndofHeader = NULL;
HttpInstance->HttpHeaders = NULL;
@@ -1014,7 +1018,7 @@ HttpResponseWorker (
//
// The data is stored at [NextMsg, CacheBody + CacheLen].
//
- HdrLen = HttpInstance->CacheBody + HttpInstance->CacheLen - HttpInstance->NextMsg;
+ HdrLen = HttpInstance->CacheBody + HttpInstance->CacheLen - HttpInstance->NextMsg;
HttpHeaders = AllocateZeroPool (HdrLen);
if (HttpHeaders == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -1026,8 +1030,8 @@ HttpResponseWorker (
HttpInstance->CacheBody = NULL;
HttpInstance->NextMsg = NULL;
HttpInstance->CacheOffset = 0;
- SizeofHeaders = HdrLen;
- BufferSize = HttpInstance->CacheLen;
+ SizeofHeaders = HdrLen;
+ BufferSize = HttpInstance->CacheLen;
//
// Check whether we cached the whole HTTP headers.
@@ -1038,7 +1042,6 @@ HttpResponseWorker (
HttpInstance->EndofHeader = &EndofHeader;
HttpInstance->HttpHeaders = &HttpHeaders;
-
if (HttpInstance->TimeoutEvent == NULL) {
//
// Create TimeoutEvent for response
@@ -1131,9 +1134,9 @@ HttpResponseWorker (
}
HttpMsg->Data.Response->StatusCode = HttpMappingToStatusCode (StatusCode);
- HttpInstance->StatusCode = StatusCode;
+ HttpInstance->StatusCode = StatusCode;
- Status = EFI_NOT_READY;
+ Status = EFI_NOT_READY;
ValueInItem = NULL;
//
@@ -1144,8 +1147,8 @@ HttpResponseWorker (
// Hence, check that case before doing a NetMapRemoveHead.
//
if (!NetMapIsEmpty (&HttpInstance->TxTokens)) {
- NetMapRemoveHead (&HttpInstance->TxTokens, (VOID**) &ValueInItem);
- if (ValueInItem == NULL) {
+ NetMapRemoveHead (&HttpInstance->TxTokens, (VOID **)&ValueInItem);
+ if (ValueInItem == NULL) {
goto Error;
}
@@ -1193,7 +1196,6 @@ HttpResponseWorker (
FreePool (HttpHeaders);
HttpHeaders = NULL;
-
//
// Init message-body parser by header information.
//
@@ -1203,7 +1205,7 @@ HttpResponseWorker (
HttpMsg->HeaderCount,
HttpMsg->Headers,
HttpBodyParserCallback,
- (VOID *) (&HttpInstance->CallbackData),
+ (VOID *)(&HttpInstance->CallbackData),
&HttpInstance->MsgParser
);
if (EFI_ERROR (Status)) {
@@ -1217,8 +1219,8 @@ HttpResponseWorker (
//
// Record the CallbackData data.
//
- HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
- HttpInstance->CallbackData.ParseData = (VOID *) HttpInstance->CacheBody;
+ HttpInstance->CallbackData.Wrap = (VOID *)Wrap;
+ HttpInstance->CallbackData.ParseData = (VOID *)HttpInstance->CacheBody;
HttpInstance->CallbackData.ParseDataLength = HttpInstance->CacheLen;
//
@@ -1279,7 +1281,7 @@ HttpResponseWorker (
//
CopyMem (HttpMsg->Body, HttpInstance->CacheBody + HttpInstance->CacheOffset, BodyLen);
HttpInstance->CacheOffset = BodyLen + HttpInstance->CacheOffset;
- HttpMsg->BodyLength = BodyLen;
+ HttpMsg->BodyLength = BodyLen;
if (HttpInstance->NextMsg == NULL) {
//
@@ -1291,6 +1293,7 @@ HttpResponseWorker (
HttpInstance->CacheOffset = 0;
}
}
+
//
// Return since we already received required data.
//
@@ -1298,12 +1301,12 @@ HttpResponseWorker (
goto Exit;
}
- if (BodyLen == 0 && HttpInstance->MsgParser == NULL) {
+ if ((BodyLen == 0) && (HttpInstance->MsgParser == NULL)) {
//
// We received a complete HTTP message, and we don't have more data to return to caller.
//
HttpMsg->BodyLength = 0;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
goto Exit;
}
}
@@ -1319,7 +1322,6 @@ HttpResponseWorker (
if (EFI_ERROR (Status)) {
goto Error2;
}
-
} else {
if (HttpInstance->TimeoutEvent == NULL) {
//
@@ -1361,15 +1363,15 @@ HttpResponseWorker (
//
// Process the received the body packet.
//
- HttpMsg->BodyLength = MIN ((UINTN) Fragment.Len, HttpMsg->BodyLength);
+ HttpMsg->BodyLength = MIN ((UINTN)Fragment.Len, HttpMsg->BodyLength);
CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
//
// Record the CallbackData data.
//
- HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
- HttpInstance->CallbackData.ParseData = HttpMsg->Body;
+ HttpInstance->CallbackData.Wrap = (VOID *)Wrap;
+ HttpInstance->CallbackData.ParseData = HttpMsg->Body;
HttpInstance->CallbackData.ParseDataLength = HttpMsg->BodyLength;
//
@@ -1396,7 +1398,7 @@ HttpResponseWorker (
// Check whether there is the next message header in the HttpMsg->Body.
//
if (HttpInstance->NextMsg != NULL) {
- HttpMsg->BodyLength = HttpInstance->NextMsg - (CHAR8 *) HttpMsg->Body;
+ HttpMsg->BodyLength = HttpInstance->NextMsg - (CHAR8 *)HttpMsg->Body;
}
HttpInstance->CacheLen = Fragment.Len - HttpMsg->BodyLength;
@@ -1491,10 +1493,8 @@ Error:
gBS->SignalEvent (Token->Event);
return Status;
-
}
-
/**
The Response() function queues an HTTP response to this HTTP instance, similar to
Receive() function in the EFI TCP driver. When the HTTP response is received successfully,
@@ -1545,14 +1545,14 @@ Error:
EFI_STATUS
EFIAPI
EfiHttpResponse (
- IN EFI_HTTP_PROTOCOL *This,
- IN EFI_HTTP_TOKEN *Token
+ IN EFI_HTTP_PROTOCOL *This,
+ IN EFI_HTTP_TOKEN *Token
)
{
- EFI_STATUS Status;
- EFI_HTTP_MESSAGE *HttpMsg;
- HTTP_PROTOCOL *HttpInstance;
- HTTP_TOKEN_WRAP *Wrap;
+ EFI_STATUS Status;
+ EFI_HTTP_MESSAGE *HttpMsg;
+ HTTP_PROTOCOL *HttpInstance;
+ HTTP_TOKEN_WRAP *Wrap;
if ((This == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1619,6 +1619,7 @@ Error:
if (Wrap->TcpWrap.Rx6Token.CompletionToken.Event != NULL) {
gBS->CloseEvent (Wrap->TcpWrap.Rx6Token.CompletionToken.Event);
}
+
FreePool (Wrap);
}
@@ -1648,11 +1649,11 @@ Error:
EFI_STATUS
EFIAPI
EfiHttpPoll (
- IN EFI_HTTP_PROTOCOL *This
+ IN EFI_HTTP_PROTOCOL *This
)
{
- EFI_STATUS Status;
- HTTP_PROTOCOL *HttpInstance;
+ EFI_STATUS Status;
+ HTTP_PROTOCOL *HttpInstance;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1668,11 +1669,13 @@ EfiHttpPoll (
if (HttpInstance->Tcp6 == NULL) {
return EFI_NOT_STARTED;
}
+
Status = HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
} else {
if (HttpInstance->Tcp4 == NULL) {
return EFI_NOT_STARTED;
}
+
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
}