]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpImpl.c
IntelSiliconPkg/PlatformVTdSample: update ExceptionDevice
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpImpl.c
index 745832b9d0bc15f85d802a4e0ad9dc381f4d7099..c104b614f35a04c5794ec49ca2a6ea73b4888a29 100644 (file)
@@ -130,7 +130,7 @@ EFI_STATUS
 EFIAPI\r
 EfiHttpConfigure (\r
   IN  EFI_HTTP_PROTOCOL         *This,\r
-  IN  EFI_HTTP_CONFIG_DATA      *HttpConfigData\r
+  IN  EFI_HTTP_CONFIG_DATA      *HttpConfigData OPTIONAL\r
   ) \r
 {\r
   HTTP_PROTOCOL                 *HttpInstance;\r
@@ -151,6 +151,10 @@ EfiHttpConfigure (
 \r
   if (HttpConfigData != NULL) {\r
 \r
+    if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+\r
     //\r
     // Now configure this HTTP instance.\r
     //\r
@@ -276,10 +280,11 @@ EfiHttpRequest (
   Request = HttpMsg->Data.Request;\r
 \r
   //\r
-  // Only support GET, HEAD, PUT and POST method in current implementation.\r
+  // Only support GET, HEAD, PATCH, PUT and POST method in current implementation.\r
   //\r
   if ((Request != NULL) && (Request->Method != HttpMethodGet) &&\r
-      (Request->Method != HttpMethodHead) && (Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost)) {\r
+      (Request->Method != HttpMethodHead) && (Request->Method != HttpMethodPut) && \r
+      (Request->Method != HttpMethodPost) && (Request->Method != HttpMethodPatch)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -299,14 +304,16 @@ EfiHttpRequest (
 \r
   if (Request == NULL) {\r
     //\r
-    // Request would be NULL only for PUT/POST operation (in the current implementation)\r
+    // Request would be NULL only for PUT/POST/PATCH operation (in the current implementation)\r
     //\r
-    if ((HttpInstance->Method != HttpMethodPut) && (HttpInstance->Method != HttpMethodPost)) {\r
+    if ((HttpInstance->Method != HttpMethodPut) && \r
+        (HttpInstance->Method != HttpMethodPost) && \r
+        (HttpInstance->Method != HttpMethodPatch)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
     //\r
-    // For PUT/POST, we need to have the TCP already configured. Bail out if it is not!\r
+    // For PUT/POST/PATCH, we need to have the TCP already configured. Bail out if it is not!\r
     //\r
     if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED) {\r
       return EFI_INVALID_PARAMETER;\r
@@ -380,6 +387,7 @@ EfiHttpRequest (
 \r
       HttpInstance->TlsChildHandle = TlsCreateChild (\r
                                        ImageHandle,\r
+                                       &(HttpInstance->TlsSb),\r
                                        &(HttpInstance->Tls),\r
                                        &(HttpInstance->TlsConfiguration)\r
                                        );\r
@@ -616,7 +624,7 @@ EfiHttpRequest (
 \r
   //\r
   // Every request we insert a TxToken and a response call would remove the TxToken.\r
-  // In cases of PUT/POST, after an initial request-response pair, we would do a\r
+  // In cases of PUT/POST/PATCH, after an initial request-response pair, we would do a\r
   // continuous request without a response call. So, in such cases, where Request\r
   // structure is NULL, we would not insert a TxToken.\r
   //\r
@@ -1112,7 +1120,7 @@ HttpResponseWorker (
     ValueInItem = NULL;\r
 \r
     //\r
-    // In cases of PUT/POST, after an initial request-response pair, we would do a\r
+    // In cases of PUT/POST/PATCH, after an initial request-response pair, we would do a\r
     // continuous request without a response call. So, we would not do an insert of\r
     // TxToken. After we have sent the complete file, we will call a response to get\r
     // a final response from server. In such a case, we would not have any TxTokens.\r
@@ -1342,7 +1350,7 @@ HttpResponseWorker (
     // We receive part of header of next HTTP msg.\r
     //\r
     if (HttpInstance->NextMsg != NULL) {\r
-      HttpMsg->BodyLength = MIN ((UINTN) (HttpInstance->NextMsg - (CHAR8 *) Fragment.Bulk), HttpMsg->BodyLength);\r
+      HttpMsg->BodyLength = MIN ((UINTN) HttpInstance->NextMsg - (UINTN) Fragment.Bulk, HttpMsg->BodyLength);\r
       CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);\r
       \r
       HttpInstance->CacheLen = Fragment.Len - HttpMsg->BodyLength;\r
@@ -1360,7 +1368,7 @@ HttpResponseWorker (
         CopyMem (HttpInstance->CacheBody, Fragment.Bulk + HttpMsg->BodyLength, HttpInstance->CacheLen);\r
         HttpInstance->CacheOffset = 0;\r
 \r
-        HttpInstance->NextMsg = HttpInstance->CacheBody + (UINTN) (HttpInstance->NextMsg - (CHAR8 *) (Fragment.Bulk + HttpMsg->BodyLength));\r
+        HttpInstance->NextMsg = HttpInstance->CacheBody + ((UINTN) HttpInstance->NextMsg - (UINTN) (Fragment.Bulk + HttpMsg->BodyLength));\r
       }\r
     } else {\r
       HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) HttpMsg->BodyLength);\r