NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

*v2: Resolve the conflict commit.

*v3: Fixed the failure if BodyLength in HTTP token is less than the received
size of HTTPS message.

HttpBodyParserCallback function is to parse the HTTP(S) message body so as to
confirm whether there is the next message header. But it doesn't record the
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Gary Lin <glin@suse.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Tested-by: Gary Lin <glin@suse.com>
This commit is contained in:
Jiaxin Wu
2018-07-02 09:48:12 +08:00
parent c6a14de3ef
commit 895b87e380
3 changed files with 78 additions and 54 deletions

View File

@@ -91,6 +91,15 @@ typedef struct {
EFI_TLS_SESSION_STATE SessionState;
} TLS_CONFIG_DATA;
//
// Callback data for HTTP_PARSER_CALLBACK()
//
typedef struct {
UINTN ParseDataLength;
VOID *ParseData;
VOID *Wrap;
} HTTP_CALLBACK_DATA;
typedef struct _HTTP_PROTOCOL {
UINT32 Signature;
EFI_HTTP_PROTOCOL Http;
@@ -149,6 +158,7 @@ typedef struct _HTTP_PROTOCOL {
// HTTP message-body parser.
//
VOID *MsgParser;
HTTP_CALLBACK_DATA CallbackData;
EFI_HTTP_VERSION HttpVersion;
UINT32 TimeOutMillisec;