mirror of https://github.com/acidanthera/audk.git
NetworkPkg:Add a new error status code EFI_HTTP_ERROR
v4: * Update macro HTTP_ERROR_STATUS to HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE Update copyright year. When the Error Status of ResponseData returned from HttpIoRecvResponse function during the Http HEAD method, it should also return error status to Load file protocol. Add a new error status code EFI_HTTP_ERROR in corresponding with the UEFI 2.6 spec . When a HTTP error occurred during the network operation, The EFI_HTTP_ERROR is returned in token. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
parent
10a3840ff9
commit
072289f45c
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementation of the boot file download function.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -717,6 +717,7 @@ HttpBootGetBootFile (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HTTP_STATUS_CODE StatusCode;
|
||||
CHAR8 *HostName;
|
||||
EFI_HTTP_REQUEST_DATA *RequestData;
|
||||
HTTP_IO_RESPONSE_DATA *ResponseData;
|
||||
|
@ -894,7 +895,12 @@ HttpBootGetBootFile (
|
|||
TRUE,
|
||||
ResponseData
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (EFI_ERROR (Status) || EFI_ERROR (ResponseData->Status)) {
|
||||
if (EFI_ERROR (ResponseData->Status)) {
|
||||
StatusCode = HttpIo->RspToken.Message->Data.Response->StatusCode;
|
||||
HttpBootPrintErrorMessage (StatusCode);
|
||||
Status = ResponseData->Status;
|
||||
}
|
||||
goto ERROR_5;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Support functions implementation for UEFI HTTP boot driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -930,7 +930,6 @@ HttpIoRecvResponse (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HTTP_PROTOCOL *Http;
|
||||
EFI_HTTP_STATUS_CODE StatusCode;
|
||||
|
||||
if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -971,17 +970,10 @@ HttpIoRecvResponse (
|
|||
//
|
||||
// Store the received data into the wrapper.
|
||||
//
|
||||
Status = HttpIo->RspToken.Status;
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount;
|
||||
ResponseData->Headers = HttpIo->RspToken.Message->Headers;
|
||||
ResponseData->BodyLength = HttpIo->RspToken.Message->BodyLength;
|
||||
}
|
||||
|
||||
if (RecvMsgHeader) {
|
||||
StatusCode = HttpIo->RspToken.Message->Data.Response->StatusCode;
|
||||
HttpBootPrintErrorMessage (StatusCode);
|
||||
}
|
||||
ResponseData->Status = HttpIo->RspToken.Status;
|
||||
ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount;
|
||||
ResponseData->Headers = HttpIo->RspToken.Message->Headers;
|
||||
ResponseData->BodyLength = HttpIo->RspToken.Message->BodyLength;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Support functions declaration for UEFI HTTP boot driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -81,6 +81,17 @@ HttpBootShowIp6Addr (
|
|||
IN EFI_IPv6_ADDRESS *Ip
|
||||
);
|
||||
|
||||
/**
|
||||
This function is to display the HTTP error status.
|
||||
|
||||
@param[in] StatusCode The status code value in HTTP message.
|
||||
|
||||
**/
|
||||
VOID
|
||||
HttpBootPrintErrorMessage (
|
||||
EFI_HTTP_STATUS_CODE StatusCode
|
||||
);
|
||||
|
||||
//
|
||||
// A wrapper structure to hold the HTTP headers.
|
||||
//
|
||||
|
@ -196,6 +207,7 @@ typedef struct {
|
|||
EFI_HTTP_HEADER *Headers;
|
||||
UINTN BodyLength;
|
||||
CHAR8 *Body;
|
||||
EFI_STATUS Status;
|
||||
} HTTP_IO_RESPONSE_DATA;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
|
@ -976,7 +976,7 @@ HttpResponseWorker (
|
|||
HttpHeaders = NULL;
|
||||
|
||||
HttpMsg->Data.Response->StatusCode = HttpMappingToStatusCode (StatusCode);
|
||||
|
||||
HttpInstance->StatusCode = StatusCode;
|
||||
//
|
||||
// Init message-body parser by header information.
|
||||
//
|
||||
|
@ -1111,7 +1111,13 @@ Exit:
|
|||
if (Item != NULL) {
|
||||
NetMapRemoveItem (&Wrap->HttpInstance->RxTokens, Item, NULL);
|
||||
}
|
||||
Token->Status = Status;
|
||||
|
||||
if (HttpInstance->StatusCode >= HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE) {
|
||||
Token->Status = EFI_HTTP_ERROR;
|
||||
} else {
|
||||
Token->Status = Status;
|
||||
}
|
||||
|
||||
gBS->SignalEvent (Token->Event);
|
||||
HttpCloseTcpRxEvent (Wrap);
|
||||
FreePool (Wrap);
|
||||
|
@ -1136,7 +1142,12 @@ Error:
|
|||
HttpInstance->CacheBody = NULL;
|
||||
}
|
||||
|
||||
Token->Status = Status;
|
||||
if (HttpInstance->StatusCode >= HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE) {
|
||||
Token->Status = EFI_HTTP_ERROR;
|
||||
} else {
|
||||
Token->Status = Status;
|
||||
}
|
||||
|
||||
gBS->SignalEvent (Token->Event);
|
||||
|
||||
return Status;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The header files of implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -23,6 +23,8 @@
|
|||
#define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"
|
||||
#define HTTP_GET_STR "GET "
|
||||
#define HTTP_HEAD_STR "HEAD "
|
||||
#define HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE 300
|
||||
|
||||
//
|
||||
// Connect method has maximum length according to EFI_HTTP_METHOD defined in
|
||||
// UEFI2.5 spec so use this.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The header files of miscellaneous routines for HttpDxe driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -90,6 +90,8 @@ typedef struct _HTTP_PROTOCOL {
|
|||
BOOLEAN InDestroy;
|
||||
INTN State;
|
||||
|
||||
UINTN StatusCode;
|
||||
|
||||
EFI_HANDLE Tcp4ChildHandle;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
EFI_TCP4_CONFIG_DATA Tcp4CfgData;
|
||||
|
|
Loading…
Reference in New Issue