diff options
author | Zhang Lubo <lubo.zhang@intel.com> | 2015-12-17 01:12:11 +0000 |
---|---|---|
committer | luobozhang <luobozhang@Edk2> | 2015-12-17 01:12:11 +0000 |
commit | 47bda627eedb0d0e88eddb54fa11e39c8a1055ff (patch) | |
tree | 908276614a4a59ad838edee4d8d44092d96e9964 /MdeModulePkg/Library | |
parent | d14198b3397d85da37d8a9f81cf233ce08c7758a (diff) | |
download | edk2-platforms-47bda627eedb0d0e88eddb54fa11e39c8a1055ff.tar.xz |
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
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c index 49fa80ba8c..143baabdec 100644 --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c @@ -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;
|