@param[out] Buffer The memory buffer to transfer the file to. IF Buffer is NULL,\r
then the size of the requested file is returned in\r
BufferSize.\r
+ @param[out] ImageType The image type of the downloaded file.\r
\r
@retval EFI_SUCCESS Successfully created.\r
@retval Others Failed to create HttpIo.\r
IN HTTP_BOOT_PRIVATE_DATA *Private,\r
IN CHAR16 *Uri,\r
IN OUT UINTN *BufferSize,\r
- OUT UINT8 *Buffer\r
+ OUT UINT8 *Buffer,\r
+ OUT HTTP_BOOT_IMAGE_TYPE *ImageType\r
)\r
{\r
LIST_ENTRY *Entry;\r
HTTP_BOOT_ENTITY_DATA *EntityData;\r
UINTN CopyedSize;\r
\r
- if (Uri == NULL || BufferSize == 0 || Buffer == NULL) {\r
+ if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
(StrCmp (Uri, Cache->RequestData->Url) == 0)) \r
{\r
//\r
- // Hit cache, check buffer size.\r
+ // Hit in cache, record image type.\r
+ //\r
+ *ImageType = Cache->ImageType;\r
+\r
+ //\r
+ // Check buffer size.\r
//\r
if (*BufferSize < Cache->EntityLength) {\r
*BufferSize = Cache->EntityLength;\r
@param[out] Buffer The memory buffer to transfer the file to. IF Buffer is NULL,\r
then the size of the requested file is returned in\r
BufferSize.\r
+ @param[out] ImageType The image type of the downloaded file.\r
\r
@retval EFI_SUCCESS The file was loaded.\r
@retval EFI_INVALID_PARAMETER BufferSize is NULL or Buffer Size is not NULL but Buffer is NULL.\r
IN HTTP_BOOT_PRIVATE_DATA *Private,\r
IN BOOLEAN HeaderOnly,\r
IN OUT UINTN *BufferSize,\r
- OUT UINT8 *Buffer\r
+ OUT UINT8 *Buffer,\r
+ OUT HTTP_BOOT_IMAGE_TYPE *ImageType\r
)\r
{\r
EFI_STATUS Status;\r
ASSERT (Private != NULL);\r
ASSERT (Private->HttpCreated);\r
\r
- if (BufferSize == NULL) {\r
+ if (BufferSize == NULL || ImageType == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
}\r
AsciiStrToUnicodeStr (Private->BootFileUri, Url);\r
if (!HeaderOnly) {\r
- Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer);\r
+ Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);\r
if (Status != EFI_NOT_FOUND) {\r
FreePool (Url);\r
return Status;\r
Status = EFI_OUT_OF_RESOURCES;\r
goto ERROR_1;\r
}\r
+ Cache->ImageType = ImageTypeMax;\r
InitializeListHead (&Cache->EntityDataList);\r
}\r
\r
goto ERROR_5;\r
}\r
\r
+ //\r
+ // Check the image type according to server's response.\r
+ //\r
+ Status = HttpBootCheckImageType (\r
+ Private->BootFileUri,\r
+ Private->BootFileUriParser,\r
+ ResponseData->HeaderCount,\r
+ ResponseData->Headers,\r
+ ImageType\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ERROR_5;\r
+ }\r
+\r
//\r
// 3.2 Cache the response header.\r
//\r
if (Cache != NULL) {\r
Cache->ResponseData = ResponseData;\r
+ Cache->ImageType = *ImageType;\r
}\r
\r
//\r