| title | IReadEntityProvider::SetEntity Method |
|---|---|
| ms.date | 10/07/2016 |
| description | The SetEntity method replaces the preloaded HTTP request entity body with the entity body that is pointed to by the pBuffer parameter. |
| ms.assetid | 894a9196-08e5-51a6-e804-6d2f6b4c28d3 |
Specifies the request entity.
virtual VOID SetEntity(
PVOID pBuffer,
DWORD cbData,
DWORD cbBuffer
) = 0; pBuffer
A pointer to a void buffer that contains the request entity.
cbData
A DWORD that contains the size of the data in pBuffer.
cbBuffer
A DWORD that contains the size of the pBuffer buffer, which should be greater than or equal to cbData.
VOID.
The SetEntity method replaces the preloaded HTTP request entity body with the entity body that is pointed to by the pBuffer parameter. The cbData parameter must specify the size, in bytes, of the data in the request entity that was returned in pBuffer, and the cbBuffer parameter must specify the size, in bytes, of the request entity buffer that is pointed to by pBuffer.
Note
cbBuffer should always be greater than or equal to cbData.
The following code example demonstrates how to create an HTTP module that performs the following tasks:
-
Allocates a 1-KB buffer. If the buffer cannot be allocated, the module returns an error and exits.
-
Creates a string that contains a response value.
-
Specifies the request entity by using the
SetEntitymethod, and then exits.
[!code-cppIReadEntityProviderSetEntity#1]
Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.
You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.
| Type | Description |
|---|---|
| Client | - IIS 7.0 on [!INCLUDEwinvista] - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on [!INCLUDEwinsrv2008] - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
| Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 - [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100] |
| Header | Httpserv.h |
IReadEntityProvider Interface
IReadEntityProvider::GetEntity Method
IHttpRequest::ReadEntityBody Method
IHttpRequest::InsertEntityBody Method