Re: [edk2] [PATCH v4] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-02-02 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Zhang, Lubo 
Sent: Tuesday, February 02, 2016 2:52 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan; Ye, Ting; Wu, Jiaxin
Subject: [PATCH v4] 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.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 10 --  
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 18 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 14 +-
 NetworkPkg/HttpDxe/HttpImpl.c| 19 +++
 NetworkPkg/HttpDxe/HttpImpl.h|  4 +++-
 NetworkPkg/HttpDxe/HttpProto.h   |  4 +++-
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index f0817e9..dd835c4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -715,10 +715,11 @@ HttpBootGetBootFile (
   IN OUT UINTN*BufferSize,
  OUT UINT8*Buffer
   )
 {
   EFI_STATUS Status;
+  EFI_HTTP_STATUS_CODE   StatusCode;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
   HTTP_IO_RESPONSE_DATA  *ResponseData;
   HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
@@ -892,11 +893,16 @@ HttpBootGetBootFile (
   Status = HttpIoRecvResponse (
  >HttpIo,
  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;
   }
 
   //
   // 3.2 Cache the response header.
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..db2af78 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UEFI HTTP boot driver.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -928,11 +928,10 @@ HttpIoRecvResponse (
  OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
   EFI_HTTP_PROTOCOL  *Http;
-  EFI_HTTP_STATUS_CODE   StatusCode;
 
   if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -969,19 +968,12 @@ 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;
 }
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index 2eba14e..8e0fc37 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ 

Re: [edk2] [PATCH v4] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-02-02 Thread Wu, Jiaxin
Looks good!
Reviewed-by: Jiaxin Wu 

-Original Message-
From: Zhang, Lubo 
Sent: Tuesday, February 2, 2016 2:52 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan; Ye, Ting; Wu, Jiaxin
Subject: [PATCH v4] 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.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 10 --  
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 18 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 14 +-
 NetworkPkg/HttpDxe/HttpImpl.c| 19 +++
 NetworkPkg/HttpDxe/HttpImpl.h|  4 +++-
 NetworkPkg/HttpDxe/HttpProto.h   |  4 +++-
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index f0817e9..dd835c4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -715,10 +715,11 @@ HttpBootGetBootFile (
   IN OUT UINTN*BufferSize,
  OUT UINT8*Buffer
   )
 {
   EFI_STATUS Status;
+  EFI_HTTP_STATUS_CODE   StatusCode;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
   HTTP_IO_RESPONSE_DATA  *ResponseData;
   HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
@@ -892,11 +893,16 @@ HttpBootGetBootFile (
   Status = HttpIoRecvResponse (
  >HttpIo,
  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;
   }
 
   //
   // 3.2 Cache the response header.
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..db2af78 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UEFI HTTP boot driver.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -928,11 +928,10 @@ HttpIoRecvResponse (
  OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
   EFI_HTTP_PROTOCOL  *Http;
-  EFI_HTTP_STATUS_CODE   StatusCode;
 
   if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -969,19 +968,12 @@ 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;
 }
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index 2eba14e..8e0fc37 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ 

[edk2] [PATCH v4] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-02-01 Thread Zhang Lubo
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.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 10 --
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 18 +-
 NetworkPkg/HttpBootDxe/HttpBootSupport.h | 14 +-
 NetworkPkg/HttpDxe/HttpImpl.c| 19 +++
 NetworkPkg/HttpDxe/HttpImpl.h|  4 +++-
 NetworkPkg/HttpDxe/HttpProto.h   |  4 +++-
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index f0817e9..dd835c4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -715,10 +715,11 @@ HttpBootGetBootFile (
   IN OUT UINTN*BufferSize,
  OUT UINT8*Buffer
   )
 {
   EFI_STATUS Status;
+  EFI_HTTP_STATUS_CODE   StatusCode;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
   HTTP_IO_RESPONSE_DATA  *ResponseData;
   HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
@@ -892,11 +893,16 @@ HttpBootGetBootFile (
   Status = HttpIoRecvResponse (
  >HttpIo,
  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;
   }
 
   //
   // 3.2 Cache the response header.
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..db2af78 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UEFI HTTP boot driver.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -928,11 +928,10 @@ HttpIoRecvResponse (
  OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
   EFI_HTTP_PROTOCOL  *Http;
-  EFI_HTTP_STATUS_CODE   StatusCode;
 
   if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -969,19 +968,12 @@ 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;
 }
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index 2eba14e..8e0fc37 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
@@ -1,9 +1,9 @@
 /** @file
   Support functions declaration for UEFI HTTP boot driver.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying 

Re: [edk2] [PATCH v4] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-02-01 Thread Fu, Siyuan
Reviewed-by: Siyuan Fu 

-Original Message-
From: Zhang, Lubo 
Sent: Tuesday, February 2, 2016 2:52 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [PATCH v4] 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.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 10 --  
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 18 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 14 +-
 NetworkPkg/HttpDxe/HttpImpl.c| 19 +++
 NetworkPkg/HttpDxe/HttpImpl.h|  4 +++-
 NetworkPkg/HttpDxe/HttpProto.h   |  4 +++-
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index f0817e9..dd835c4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -715,10 +715,11 @@ HttpBootGetBootFile (
   IN OUT UINTN*BufferSize,
  OUT UINT8*Buffer
   )
 {
   EFI_STATUS Status;
+  EFI_HTTP_STATUS_CODE   StatusCode;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
   HTTP_IO_RESPONSE_DATA  *ResponseData;
   HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
@@ -892,11 +893,16 @@ HttpBootGetBootFile (
   Status = HttpIoRecvResponse (
  >HttpIo,
  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;
   }
 
   //
   // 3.2 Cache the response header.
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..db2af78 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UEFI HTTP boot driver.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -928,11 +928,10 @@ HttpIoRecvResponse (
  OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
   EFI_HTTP_PROTOCOL  *Http;
-  EFI_HTTP_STATUS_CODE   StatusCode;
 
   if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -969,19 +968,12 @@ 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;
 }
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index 2eba14e..8e0fc37 100644
---