NetworkPkg/HttpDxe: Support HTTP Patch method

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu 2017-08-02 15:51:47 +08:00
parent 1fceaddb12
commit 97c567efd3
1 changed files with 10 additions and 7 deletions

View File

@ -276,10 +276,11 @@ EfiHttpRequest (
Request = HttpMsg->Data.Request; 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) && 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; return EFI_UNSUPPORTED;
} }
@ -299,14 +300,16 @@ EfiHttpRequest (
if (Request == NULL) { 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; 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) { if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -617,7 +620,7 @@ EfiHttpRequest (
// //
// Every request we insert a TxToken and a response call would remove the TxToken. // 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 // continuous request without a response call. So, in such cases, where Request
// structure is NULL, we would not insert a TxToken. // structure is NULL, we would not insert a TxToken.
// //
@ -1113,7 +1116,7 @@ HttpResponseWorker (
ValueInItem = NULL; 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 // 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 // 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. // a final response from server. In such a case, we would not have any TxTokens.