From b16abfcc3497a51e32214bb50f4be8c3a36fa5f0 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Wed, 22 Nov 2017 14:34:30 +0800 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 Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Fu Siyuan --- 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 1aa1816c52..925281a9c0 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1877,9 +1877,6 @@ HttpTcpReceiveHeader ( // Check whether we received end of HTTP headers. // *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); - if (*EndofHeader != NULL) { - *SizeofHeaders = *EndofHeader - *HttpHeaders; - } }; // @@ -1979,9 +1976,6 @@ HttpTcpReceiveHeader ( // Check whether we received end of HTTP headers. // *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); - if (*EndofHeader != NULL) { - *SizeofHeaders = *EndofHeader - *HttpHeaders; - } }; // @@ -2002,7 +1996,9 @@ 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; }