BOOLEAN ReConfigure;\r
CHAR8 *RequestStr;\r
CHAR8 *Url;\r
+ UINTN UrlLen;\r
CHAR16 *HostNameStr;\r
HTTP_TOKEN_WRAP *Wrap;\r
HTTP_TCP_TOKEN_WRAP *TcpWrap;\r
return EFI_ACCESS_DENIED; \r
} \r
\r
- Url = NULL;\r
HostName = NULL;\r
Wrap = NULL;\r
HostNameStr = NULL;\r
//\r
// Parse the URI of the remote host.\r
//\r
- Url = AllocatePool (StrLen (Request->Url) + 1);\r
- if (Url == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
+ Url = HttpInstance->Url;\r
+ UrlLen = StrLen (Request->Url) + 1;\r
+ if (UrlLen > HTTP_URL_BUFFER_LEN) {\r
+ Url = AllocateZeroPool (UrlLen);\r
+ if (Url == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ FreePool (HttpInstance->Url);\r
+ HttpInstance->Url = Url; \r
+ } \r
\r
UnicodeStrToAsciiStr (Request->Url, Url);\r
UrlParser = NULL;\r
Configure = TRUE;\r
ReConfigure = TRUE; \r
\r
- if (HttpInstance->RemoteHost == NULL && HttpInstance->RemotePort == 0) {\r
+ if (HttpInstance->RemoteHost == NULL) {\r
//\r
// Request() is called the first time. \r
//\r
\r
Wrap->TcpWrap.Method = Request->Method;\r
\r
- FreePool (Url);\r
FreePool (HostName);\r
\r
//\r
if (HttpInstance->RemoteHost != NULL) {\r
FreePool (HttpInstance->RemoteHost);\r
HttpInstance->RemoteHost = NULL;\r
+ HttpInstance->RemotePort = 0;\r
}\r
}\r
} \r
goto Error4;\r
}\r
\r
- FreePool (Url);\r
if (HostName != NULL) {\r
FreePool (HostName);\r
}\r
goto Error5; \r
}\r
\r
+ DispatchDpc ();\r
+\r
return EFI_SUCCESS;\r
\r
Error5:\r
HttpCloseTcp4ConnCloseEvent (HttpInstance);\r
if (NULL != Wrap->TcpWrap.TxToken.CompletionToken.Event) {\r
gBS->CloseEvent (Wrap->TcpWrap.TxToken.CompletionToken.Event);\r
+ Wrap->TcpWrap.TxToken.CompletionToken.Event = NULL;\r
}\r
\r
Error1:\r
- if (Url != NULL) {\r
- FreePool (Url);\r
- }\r
if (HostName != NULL) {\r
FreePool (HostName);\r
}\r
\r
@retval EFI_SUCCESS Allocation succeeded.\r
@retval EFI_OUT_OF_RESOURCES Failed to complete the opration due to lack of resources.\r
- @retval EFI_NOT_READY Can't find a corresponding TxToken.\r
+ @retval EFI_NOT_READY Can't find a corresponding TxToken or \r
+ the EFI_HTTP_UTILITIES_PROTOCOL is not available.\r
\r
**/\r
EFI_STATUS\r
CopyMem (HeaderTmp, Tmp, SizeofHeaders);\r
FreePool (HttpHeaders);\r
HttpHeaders = HeaderTmp;\r
+\r
+ //\r
+ // Check whether the EFI_HTTP_UTILITIES_PROTOCOL is available.\r
+ //\r
+ if (mHttpUtilities == NULL) {\r
+ Status = EFI_NOT_READY;\r
+ goto Error;\r
+ }\r
+ \r
//\r
// Parse the HTTP header into array of key/value pairs.\r
//\r
- Status = HttpUtilitiesParse (HttpHeaders, SizeofHeaders, &HttpMsg->Headers, &HttpMsg->HeaderCount);\r
+ Status = mHttpUtilities->Parse (\r
+ mHttpUtilities, \r
+ HttpHeaders, \r
+ SizeofHeaders, \r
+ &HttpMsg->Headers, \r
+ &HttpMsg->HeaderCount\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Error;\r
}\r
)\r
{\r
HTTP_PROTOCOL *HttpInstance;\r
+ EFI_STATUS Status;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_NOT_STARTED;\r
}\r
\r
- return HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);\r
+ Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);\r
+\r
+ DispatchDpc ();\r
+\r
+ return Status;\r
}\r