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
-\r
+ CHAR8 *FileUrl;\r
+ \r
if ((This == NULL) || (Token == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\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
+ 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
\r
Wrap->TcpWrap.Method = Request->Method;\r
\r
- FreePool (Url);\r
FreePool (HostName);\r
\r
//\r
//\r
// Create request message.\r
//\r
- RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);\r
+ FileUrl = Url;\r
+ if (*FileUrl != '/') {\r
+ //\r
+ // Convert the absolute-URI to the absolute-path\r
+ //\r
+ while (*FileUrl != ':') {\r
+ FileUrl++;\r
+ }\r
+ if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {\r
+ FileUrl += 3;\r
+ while (*FileUrl != '/') {\r
+ FileUrl++;\r
+ }\r
+ } else {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Error3;\r
+ }\r
+ }\r
+ RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);\r
if (RequestStr == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Error3;\r
goto Error4;\r
}\r
\r
- FreePool (Url);\r
if (HostName != NULL) {\r
FreePool (HostName);\r
}\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
HTTP_TOKEN_WRAP *ValueInItem;\r
UINTN HdrLen;\r
\r
+ if (Wrap == NULL || Wrap->HttpInstance == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ \r
HttpInstance = Wrap->HttpInstance;\r
Token = Wrap->HttpToken;\r
\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