MdeModulePkg:Fix a bug HttpLib can't parse last chunked data well

When HttpLib parsing the last chunked data down, the Http NextMsg pointer
in the HttpBodyParserCallback function should point to the character
after '/n' flag.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19310 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Zhang Lubo 2015-12-17 01:12:11 +00:00 committed by luobozhang
parent d14198b339
commit 47bda627ee
1 changed files with 24 additions and 15 deletions

View File

@ -1161,21 +1161,7 @@ HttpParseMessageBody (
switch (Parser->State) {
case BodyParserStateMax:
return EFI_ABORTED;
case BodyParserComplete:
if (Parser->Callback != NULL) {
Status = Parser->Callback (
BodyParseEventOnComplete,
Char,
0,
Parser->Context
);
if (EFI_ERROR (Status)) {
return Status;
}
}
return EFI_SUCCESS;
case BodyParserBodyIdentity:
//
// Identity transfer-coding, just notify user to save the body data.
@ -1195,6 +1181,17 @@ HttpParseMessageBody (
Parser->ParsedBodyLength += MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength);
if (Parser->ParsedBodyLength == Parser->ContentLength) {
Parser->State = BodyParserComplete;
if (Parser->Callback != NULL) {
Status = Parser->Callback (
BodyParseEventOnComplete,
Char,
0,
Parser->Context
);
if (EFI_ERROR (Status)) {
return Status;
}
}
}
break;
@ -1272,6 +1269,18 @@ HttpParseMessageBody (
case BodyParserLastCRLFEnd:
if (*Char == '\n') {
Parser->State = BodyParserComplete;
Char++;
if (Parser->Callback != NULL) {
Status = Parser->Callback (
BodyParseEventOnComplete,
Char,
0,
Parser->Context
);
if (EFI_ERROR (Status)) {
return Status;
}
}
break;
} else {
Parser->State = BodyParserStateMax;