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:
Zhang Lubo
2016-01-29 11:17:34 +08:00
committed by Jiaxin Wu
parent 10a3840ff9
commit 072289f45c
6 changed files with 47 additions and 22 deletions

View File

@ -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;