Reviewed-by: Ye Ting <ting...@intel.com> 

-----Original Message-----
From: Wu, Jiaxin 
Sent: Wednesday, August 02, 2017 4:01 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/HttpDxe: Support HTTP Patch method

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index 8a9e573..e0fecac 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -274,14 +274,15 @@ EfiHttpRequest (
   }
 
   Request = HttpMsg->Data.Request;
 
   //
-  // Only support GET, HEAD, PUT and POST method in current implementation.
+  // Only support GET, HEAD, PATCH, PUT and POST method in current 
implementation.
   //
   if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
-      (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodPut) && (Request->Method != HttpMethodPost)) {
+      (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodPut) && 
+      (Request->Method != HttpMethodPost) && (Request->Method != 
+ HttpMethodPatch)) {
     return EFI_UNSUPPORTED;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL);
@@ -297,18 +298,20 @@ EfiHttpRequest (
     return EFI_NOT_STARTED;
   }
 
   if (Request == NULL) {
     //
-    // Request would be NULL only for PUT/POST operation (in the current 
implementation)
+    // Request would be NULL only for PUT/POST/PATCH operation (in the 
+ current implementation)
     //
-    if ((HttpInstance->Method != HttpMethodPut) && (HttpInstance->Method != 
HttpMethodPost)) {
+    if ((HttpInstance->Method != HttpMethodPut) && 
+        (HttpInstance->Method != HttpMethodPost) && 
+        (HttpInstance->Method != HttpMethodPatch)) {
       return EFI_INVALID_PARAMETER;
     }
 
     //
-    // For PUT/POST, we need to have the TCP already configured. Bail out if 
it is not!
+    // For PUT/POST/PATCH, we need to have the TCP already configured. Bail 
out if it is not!
     //
     if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED) {
       return EFI_INVALID_PARAMETER;
     }
 
@@ -615,11 +618,11 @@ EfiHttpRequest (
 
   ASSERT (RequestMsg != NULL);
 
   //
   // Every request we insert a TxToken and a response call would remove the 
TxToken.
-  // In cases of PUT/POST, after an initial request-response pair, we would do 
a
+  // In cases of PUT/POST/PATCH, after an initial request-response 
+ pair, we would do a
   // continuous request without a response call. So, in such cases, where 
Request
   // structure is NULL, we would not insert a TxToken.
   //
   if (Request != NULL) {
     Status = NetMapInsertTail (&HttpInstance->TxTokens, Token, Wrap); @@ 
-1111,11 +1114,11 @@ HttpResponseWorker (
 
     Status = EFI_NOT_READY;
     ValueInItem = NULL;
 
     //
-    // In cases of PUT/POST, after an initial request-response pair, we would 
do a
+    // In cases of PUT/POST/PATCH, after an initial request-response 
+ pair, we would do a
     // continuous request without a response call. So, we would not do an 
insert of
     // TxToken. After we have sent the complete file, we will call a response 
to get
     // a final response from server. In such a case, we would not have any 
TxTokens.
     // Hence, check that case before doing a NetMapRemoveHead.
     //
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to