HttpSendResponseEntityBody function (http.h)
The HttpSendResponseEntityBody function sends entity-body data associated with an HTTP response.
Syntax
HTTPAPI_LINKAGE ULONG HttpSendResponseEntityBody(
[in] HANDLE RequestQueueHandle,
[in] HTTP_REQUEST_ID RequestId,
[in] ULONG Flags,
[in] USHORT EntityChunkCount,
[in] PHTTP_DATA_CHUNK EntityChunks,
[out] PULONG BytesSent,
[in] PVOID Reserved1,
[in] ULONG Reserved2,
[in] LPOVERLAPPED Overlapped,
[in, optional] PHTTP_LOG_DATA LogData
);
Parameters
[in] RequestQueueHandle
A handle to the request queue from which the specified request was retrieved. A request queue is created and its handle returned by a call to the HttpCreateRequestQueue function.
Windows Server 2003 with SP1 and Windows XP with SP2: The handle to the request queue is created by the HttpCreateHttpHandle function.
[in] RequestId
An identifier of the HTTP request to which this response corresponds. This value is returned in the RequestId member of the HTTP_REQUEST structure by a call to the HttpReceiveHttpRequest function. It cannot be HTTP_NULL_ID.
[in] Flags
A parameter that can include one of the following mutually exclusive flag values.
Flags | Meaning |
---|---|
|
The network connection should be disconnected after sending this response, overriding any persistent connection features associated with the version of HTTP in use. Applications should use this flag to indicate the end of the entity in cases where neither content length nor chunked encoding is used. |
|
Additional entity body data for this response is sent by the application through one or more subsequent calls to HttpSendResponseEntityBody. The last call then sets this flag to zero. |
|
This flag enables buffering of data in the kernel on a per-response basis.
It should be used by an application doing synchronous I/O, or by a an application doing asynchronous I/O with no more than one send outstanding at a time. Applications using asynchronous I/O which may have more than one send outstanding at a time should not use this flag. When this flag is set, it should be used consistently in calls to the HttpSendHttpResponse function as well. Windows Server 2003: This flag is not supported. This flag is new for Windows Server 2003 with SP1. |
|
Enables the TCP nagling algorithm for this send only.
Windows Vista and later: This flag is not supported. |
|
Specifies that for a range request, the full response content is passed and the caller wants the HTTP API to process ranges appropriately.
Note This flag is only supported for responses to HTTP GET requests and offers a limited subset of functionality. Applications that require full range processing should perform it in user mode and not rely on HTTP.sys. It's usage is discouraged.
Note This flag is supported. |
|
Specifies that the request/response is not
HTTP compliant and all subsequent bytes should be treated as entity-body. Applications specify this flag when it is accepting a Web Socket upgrade request and informing HTTP.sys to treat the connection data as opaque data.
This flag is only allowed when the StatusCode member of pHttpResponse is 101, switching protocols. HttpSendResponseEntityBody returns ERROR_INVALID_PARAMETER for all other HTTP response types if this flag is used. Windows 8 and later: This flag is supported. |
[in] EntityChunkCount
A number of structures in the array pointed to by pEntityChunks. This count cannot exceed 9999.
[in] EntityChunks
A pointer to an array of HTTP_DATA_CHUNK structures to be sent as entity-body data.
[out] BytesSent
Optional. A pointer to a variable that receives the number, in bytes, sent if the function operates synchronously.
When making an asynchronous call using pOverlapped, set pBytesSent to NULL. Otherwise, when pOverlapped is set to NULL, pBytesSent must contain a valid memory address, and not be set to NULL.
[in] Reserved1
This parameter is reserved and must be NULL.
[in] Reserved2
This parameter is reserved and must be zero.
[in] Overlapped
For asynchronous calls, set pOverlapped to point to an OVERLAPPED structure; for synchronous calls, set it to NULL.
A synchronous call blocks until all response data specified in the pEntityChunks parameter is sent, whereas an asynchronous call immediately returns ERROR_IO_PENDING and the calling application then uses GetOverlappedResult or I/O completion ports to determine when the operation is completed. For more information about using OVERLAPPED structures for synchronization, see Synchronization and Overlapped Input and Output.
[in, optional] LogData
A pointer to the HTTP_LOG_DATA structure used to log the response. Pass a pointer to the HTTP_LOG_FIELDS_DATA structure and cast it to PHTTP_LOG_DATA.
Be aware that even when logging is enabled on a URL Group, or server session, the response will not be logged unless the application supplies the log fields data structure.
Windows Server 2003 and Windows XP with SP2: This parameter is reserved and must be NULL.
Windows Vista and Windows Server 2008: This parameter is new for Windows Vista, and Windows Server 2008
Return value
If the function succeeds, the return value is NO_ERROR.
If the function is used asynchronously, a return value of ERROR_IO_PENDING indicates that the next request is not yet ready and is retrieved later through normal overlapped I/O completion mechanisms.
If the function fails, the return value is one of the following error codes.
Value | Meaning |
---|---|
|
One or more of the supplied parameters is in an unusable form. |
|
There is a call pending to HttpSendHttpResponse or HttpSendResponseEntityBody having the same RequestId. |
|
A system error code defined in WinError.h. |
Remarks
If neither a Content-length header nor a Transfer-encoding header is included in the response headers, the application must indicate the end of the response by explicitly closing the connection using the HTTP_SEND_RESPONSE_DISCONNECT flag.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista, Windows XP with SP2 [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | http.h |
Library | Httpapi.lib |
DLL | Httpapi.dll |