public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in HttpTcpReceiveHeader().
@ 2017-11-22  6:35 Jiaxin Wu
  2017-11-22  6:38 ` Fu, Siyuan
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2017-11-22  6:35 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Wu Jiaxin

Commit 19bd133562df951ae7ff7e1fff99b11a25b4cb6d is to fix the incorrect SizeofHeaders
returned from HttpTcpReceiveHeader(). But it missed the "\r\n\r\n" calculation, which
will cause the later HttpHeaders parsing failure.

This patch is fix the above issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/HttpDxe/HttpProto.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 1aa1816..925281a 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1875,13 +1875,10 @@ HttpTcpReceiveHeader (
 
       //
       // Check whether we received end of HTTP headers.
       //
       *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
-      if (*EndofHeader != NULL) {
-        *SizeofHeaders = *EndofHeader - *HttpHeaders;
-      }
     };
     
     //
     // Free the buffer.
     //
@@ -1977,13 +1974,10 @@ HttpTcpReceiveHeader (
 
       //
       // Check whether we received end of HTTP headers.
       //
       *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); 
-      if (*EndofHeader != NULL) {
-        *SizeofHeaders = *EndofHeader - *HttpHeaders;
-      }
     };
 
     //
     // Free the buffer.
     //
@@ -2000,11 +1994,13 @@ HttpTcpReceiveHeader (
   }     
 
   //
   // Skip the CRLF after the HTTP headers.
   //
-  *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR);  
+  *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR);
+
+  *SizeofHeaders = *EndofHeader - *HttpHeaders;
 
   return EFI_SUCCESS;
 }
 
 /**
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in HttpTcpReceiveHeader().
  2017-11-22  6:35 [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in HttpTcpReceiveHeader() Jiaxin Wu
@ 2017-11-22  6:38 ` Fu, Siyuan
  0 siblings, 0 replies; 2+ messages in thread
From: Fu, Siyuan @ 2017-11-22  6:38 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

> -----Original Message-----
> From: Wu, Jiaxin
> Sent: Wednesday, November 22, 2017 2:36 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in
> HttpTcpReceiveHeader().
> 
> Commit 19bd133562df951ae7ff7e1fff99b11a25b4cb6d is to fix the incorrect
> SizeofHeaders
> returned from HttpTcpReceiveHeader(). But it missed the "\r\n\r\n"
> calculation, which
> will cause the later HttpHeaders parsing failure.
> 
> This patch is fix the above issue.
> 
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
>  NetworkPkg/HttpDxe/HttpProto.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/NetworkPkg/HttpDxe/HttpProto.c
> b/NetworkPkg/HttpDxe/HttpProto.c
> index 1aa1816..925281a 100644
> --- a/NetworkPkg/HttpDxe/HttpProto.c
> +++ b/NetworkPkg/HttpDxe/HttpProto.c
> @@ -1875,13 +1875,10 @@ HttpTcpReceiveHeader (
> 
>        //
>        // Check whether we received end of HTTP headers.
>        //
>        *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
> -      if (*EndofHeader != NULL) {
> -        *SizeofHeaders = *EndofHeader - *HttpHeaders;
> -      }
>      };
> 
>      //
>      // Free the buffer.
>      //
> @@ -1977,13 +1974,10 @@ HttpTcpReceiveHeader (
> 
>        //
>        // Check whether we received end of HTTP headers.
>        //
>        *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
> -      if (*EndofHeader != NULL) {
> -        *SizeofHeaders = *EndofHeader - *HttpHeaders;
> -      }
>      };
> 
>      //
>      // Free the buffer.
>      //
> @@ -2000,11 +1994,13 @@ HttpTcpReceiveHeader (
>    }
> 
>    //
>    // Skip the CRLF after the HTTP headers.
>    //
> -  *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR);
> +  *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR);
> +
> +  *SizeofHeaders = *EndofHeader - *HttpHeaders;
> 
>    return EFI_SUCCESS;
>  }
> 
>  /**
> --
> 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-22  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22  6:35 [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in HttpTcpReceiveHeader() Jiaxin Wu
2017-11-22  6:38 ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox