This file defines the EFI HTTP Protocol interface. It is split into the following two main sections: HTTP Service Binding Protocol (HTTPSB) HTTP Protocol (HTTP)
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- Revision Reference:
- This Protocol is introduced in UEFI Specification 2.5
Abort an asynchronous HTTP request or response token.
The Cancel() function aborts a pending HTTP request or response transaction. If Token is not NULL and the token is in transmit or receive queues when it is being cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will be signaled. If the token is not in one of the queues, which usually means that the asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL, all asynchronous tokens issued by Request() or Response() will be aborted.
- Parameters
-
| [in] | This | Pointer to EFI_HTTP_PROTOCOL instance. |
| [in] | Token | Point to storage containing HTTP request or response token. |
- Return values
-
| EFI_SUCCESS | Request and Response queues are successfully flushed. |
| EFI_INVALID_PARAMETER | This is NULL. |
| EFI_NOT_STARTED | This instance hasn't been configured. |
| EFI_NOT_FOUND | The asynchronous request or response token is not found. |
| EFI_UNSUPPORTED | The implementation does not support this function. |
Initialize or brutally reset the operational parameters for this EFI HTTP instance.
The Configure() function does the following: When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring timeout, local address, port, etc. When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active connections with remote hosts, canceling all asynchronous tokens, and flush request and response buffers without informing the appropriate hosts.
No other EFI HTTP function can be executed by this instance until the Configure() function is executed and returns successfully.
- Parameters
-
| [in] | This | Pointer to EFI_HTTP_PROTOCOL instance. |
| [in] | HttpConfigData | Pointer to the configure data to configure the instance. |
- Return values
-
| EFI_SUCCESS | Operation succeeded. |
| EFI_INVALID_PARAMETER | One or more of the following conditions is TRUE: This is NULL. HttpConfigData->LocalAddressIsIPv6 is FALSE and HttpConfigData->AccessPoint.IPv4Node is NULL. HttpConfigData->LocalAddressIsIPv6 is TRUE and HttpConfigData->AccessPoint.IPv6Node is NULL. |
| EFI_ALREADY_STARTED | Reinitialize this HTTP instance without calling Configure() with NULL to reset it. |
| EFI_DEVICE_ERROR | An unexpected system or network error occurred. |
| EFI_OUT_OF_RESOURCES | Could not allocate enough system resources when executing Configure(). |
| EFI_UNSUPPORTED | One or more options in ConfigData are not supported in the implementation. |
The Response() function queues an HTTP response to this HTTP instance, similar to Receive() function in the EFI TCP driver. When the HTTP Response is received successfully, or if there is an error, Status in token will be updated and Event will be signaled.
The HTTP driver will queue a receive token to the underlying TCP instance. When data is received in the underlying TCP instance, the data will be parsed and Token will be populated with the response data. If the data received from the remote host contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting (asynchronously) for more data to be sent from the remote host before signaling Event in Token.
It is the responsibility of the caller to allocate a buffer for Body and specify the size in BodyLength. If the remote host provides a response that contains a content body, up to BodyLength bytes will be copied from the receive buffer into Body and BodyLength will be updated with the amount of bytes received and copied to Body. This allows the client to download a large file in chunks instead of into one contiguous block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive token to underlying TCP instance. If data arrives in the receive buffer, up to BodyLength bytes of data will be copied to Body. The HTTP driver will then update BodyLength with the amount of bytes received and copied to Body.
If the HTTP driver does not have an open underlying TCP connection with the host specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain an open TCP connection between client and host.
- Parameters
-
| [in] | This | Pointer to EFI_HTTP_PROTOCOL instance. |
| [in] | Token | Pointer to storage containing HTTP response token. |
- Return values
-
| EFI_SUCCESS | Allocation succeeded. |
| EFI_NOT_STARTED | This EFI HTTP Protocol instance has not been initialized. |
| EFI_INVALID_PARAMETER | One or more of the following conditions is TRUE: This is NULL. Token is NULL. Token->Message->Headers is NULL. Token->Message is NULL. Token->Message->Body is not NULL, Token->Message->BodyLength is non-zero, and Token->Message->Data is NULL, but a previous call to Response() has not been completed successfully. |
| EFI_OUT_OF_RESOURCES | Could not allocate enough system resources. |
| EFI_ACCESS_DENIED | An open TCP connection is not present with the host specified by response URL. |