Revision: 19324
          http://sourceforge.net/p/edk2/code/19324
Author:   vanjeff
Date:     2015-12-17 15:15:13 +0000 (Thu, 17 Dec 2015)
Log Message:
-----------
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.

(Sync patch r19310 from main trunk.)

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

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/19310

Modified Paths:
--------------
    branches/UDK2015/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c

Modified: branches/UDK2015/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
===================================================================
--- branches/UDK2015/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c       
2015-12-17 15:14:25 UTC (rev 19323)
+++ branches/UDK2015/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c       
2015-12-17 15:15:13 UTC (rev 19324)
@@ -1161,21 +1161,7 @@
     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 @@
       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 @@
     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;


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to