From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C911C21DF37AD for ; Wed, 2 Aug 2017 00:59:00 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2017 01:01:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,310,1498546800"; d="scan'208";a="132409492" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.149]) by orsmga005.jf.intel.com with ESMTP; 02 Aug 2017 01:01:08 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Wed, 2 Aug 2017 16:01:01 +0800 Message-Id: <1501660861-11492-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] NetworkPkg/HttpDxe: Support HTTP Patch method X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 07:59:00 -0000 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- 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