|
| 1 | +--- |
| 2 | +title: HttpQueryRequestProperty |
| 3 | +description: Gives an application access to find-grained information about a request. |
| 4 | +ms.topic: reference |
| 5 | +ms.date: 04/25/2025 |
| 6 | +req.lib: |
| 7 | +req.dll: httpapi.dll |
| 8 | +topic_type: |
| 9 | +- APIRef |
| 10 | +- kbSyntax |
| 11 | +api_type: |
| 12 | +- DllExport |
| 13 | +api_location: |
| 14 | +- Kernelbase.dll |
| 15 | +api_name: |
| 16 | +- HttpQueryRequestProperty |
| 17 | +targetos: Windows |
| 18 | +ms.localizationpriority: low |
| 19 | +--- |
| 20 | + |
| 21 | +# HttpQueryRequestProperty function |
| 22 | + |
| 23 | +Gives an application access to find-grained information about a request. Mostly connection flow statistics, but also the Server Name Indication (SNI—presents the server domain name requested by the client to the server so that it can select the correct certificate, among other reasons), and other traits of the underlying TLS connection (when applicable). |
| 24 | + |
| 25 | +The [HTTP_REQUEST](/previous-versions/windows/desktop/legacy/aa364545(v=vs.85)) structure gets filled in with the information that pretty much every server application will need in order to respond to a request, and **HttpQueryRequestProperty** is for getting useful diagnostic data about a request, or more detailed information where it's going to be really necessary. Most applications aren't concerned with the precise breakdown of timings for API calls, but very large or very performance-driven applications or teams might want those details for better debugging. But be aware that there's a cost associated with gathering or retrieving most of the data covered by **HttpQueryRequestProperty**. |
| 26 | + |
| 27 | +Whereas [HttpSetRequestProperty](/windows/win32/api/http/nf-http-httpsetrequestproperty) works on just two values in [HTTP_REQUEST_PROPERTY](/windows/win32/api/http/ne-http-http_request_property), the HttpQueryRequestProperty function works on all of them. |
| 28 | + |
| 29 | +See **Remarks** for info about how to call the function. |
| 30 | + |
| 31 | +## Syntax |
| 32 | + |
| 33 | +```cpp |
| 34 | +HTTPAPI_LINKAGE ULONG WINAPI |
| 35 | +HttpQueryRequestProperty( |
| 36 | + _In_ HANDLE RequestQueueHandle, |
| 37 | + _In_ HTTP_OPAQUE_ID Id, |
| 38 | + _In_ HTTP_REQUEST_PROPERTY PropertyId, |
| 39 | + _In_reads_bytes_opt_(QualifierSize) VOID *Qualifier, |
| 40 | + _In_ ULONG QualifierSize, |
| 41 | + _Out_writes_bytes_to_opt_(OutputBufferSize, *BytesReturned) PVOID Output, |
| 42 | + _In_ ULONG OutputBufferSize, |
| 43 | + _Out_opt_ PULONG BytesReturned, |
| 44 | + _In_opt_ LPOVERLAPPED Overlapped |
| 45 | +); |
| 46 | +``` |
| 47 | + |
| 48 | +## Parameters |
| 49 | + |
| 50 | +`RequestQueueHandle` |
| 51 | + |
| 52 | +Type: \_In\_ **HANDLE** |
| 53 | + |
| 54 | +The handle to the request queue where the request being queried was received. |
| 55 | + |
| 56 | +`Id` |
| 57 | + |
| 58 | +Type: \_In\_ **HTTP_OPAQUE_ID** |
| 59 | + |
| 60 | +The opaque ID of the request. |
| 61 | + |
| 62 | +`PropertyId` |
| 63 | + |
| 64 | +Type: \_In\_ **[HTTP_REQUEST_PROPERTY](/windows/win32/api/http/ne-http-http_request_property)** |
| 65 | + |
| 66 | +A member of the **HTTP_REQUEST_PROPERTY** enumeration describing the property type that's set. The enumeration includes notes about supported properties and how to enable them. |
| 67 | + |
| 68 | +`Qualifier` |
| 69 | + |
| 70 | +Type: \_In\_reads\_bytes\_opt\_(QualifierSize) **VOID \*** |
| 71 | + |
| 72 | +An optional parameter required for some values of *PropertyId* to identify bounds on what data you're requesting. For the Stats options, it can be used to define the window of time to look back for connection statistics. |
| 73 | + |
| 74 | +`QualifierSize` |
| 75 | + |
| 76 | +Type: \_In\_ **ULONG** |
| 77 | + |
| 78 | +The size of the structure passed in *Qualifier*. If *Qualifier* is `NULL`, then set this to 0. |
| 79 | + |
| 80 | +`Output` |
| 81 | + |
| 82 | +Type: \_Out\_writes\_bytes\_to\_opt\_(OutputBufferSize, *BytesReturned) **PVOID** |
| 83 | + |
| 84 | +Receives the contents of the property requested. You're responsible for allocating and freeing this buffer. For many properties, this is a fixed-size buffer depending on the property requested. See [HTTP_REQUEST_PROPERTY](/windows/win32/api/http/ne-http-http_request_property) for the specifics of a given property. |
| 85 | + |
| 86 | +When a property returns a variable-length buffer, you can probe for the size of buffer needed by leaving this parameter `NULL`, and passing in a pointer for *BytesReturned*. For more details, see [HTTP_REQUEST_PROPERTY](/windows/win32/api/http/ne-http-http_request_property). |
| 87 | + |
| 88 | +`OutputBufferSize` |
| 89 | + |
| 90 | +Type: \_In\_ **ULONG** |
| 91 | + |
| 92 | +The size of the buffer passed in *Output*, or 0 if it's NULL. |
| 93 | + |
| 94 | +`BytesReturned` |
| 95 | + |
| 96 | +Type: \_Out\_opt\_ **PULONG** |
| 97 | + |
| 98 | +Returns the number of bytes written to *Output*. Or, for variable-length properties, can return the size of buffer needed if *Output* wasn't large enough. For variable-length properties, you should call first with *Output* set to `NULL` so that you can retrieve through *BytesReturned* the buffer size you need, then allocate that amount of memory, then retry the query. |
| 99 | + |
| 100 | +`Overlapped` |
| 101 | + |
| 102 | +Type: \_In\_opt\_ **LPOVERLAPPED** |
| 103 | + |
| 104 | +While you can provide an **OVERLAPPED** structure for asynchronous operation, setting this parameter is not a guarantee that the API will run asynchronously; most operations on this API are always synchronous. The event in this structure is used only if the API returns **ERROR_IO_PENDING**. |
| 105 | + |
| 106 | +## Return value |
| 107 | + |
| 108 | +Type: **ULONG** |
| 109 | + |
| 110 | +If the function succeeds, then the return value is **ERROR_SUCCESS**. If an **OVERLAPPED** structure is provided, and the function runs asynchronously, then **ERROR_IO_PENDING** will be returned, and is not an error. |
| 111 | + |
| 112 | +If the function fails, then the return value is one of the following error codes: |
| 113 | + |
| 114 | +|Return code|Description| |
| 115 | +|-|-| |
| 116 | +|**ERROR_INVALID_PARAMETER**|One or more of the arguments is invalid.| |
| 117 | +|**ERROR_INVALID_FUNCTION**|The request doesn't support the property you've queried.| |
| 118 | +|**ERROR_MORE_DATA**|The size of the output buffer is insufficient, allocate a larger buffer for the next request.| |
| 119 | +|Other|Check the [system error codes](/windows/win32/debug/system-error-codes) defined in `WinError.h`| |
| 120 | + |
| 121 | +## Remarks |
| 122 | + |
| 123 | +This function does not have an associated header file or library file. Your application can call [**LoadLibrary**](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya) with the DLL name (`httpapi.dll`) to obtain a module handle. It can then call [**GetProcAddress**](/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress) with the module handle and the name of this function to get the function address. |
| 124 | + |
| 125 | +## Requirements |
| 126 | + |
| 127 | +| | | |
| 128 | +| ---- |:---- | |
| 129 | +| **Minimum supported client** | Windows 10, version 1709 [desktop apps only] | |
| 130 | +| **Minimum supported server** | Windows Server, version 1709 [desktop apps only] | |
| 131 | +| **Target Platform** | Windows | |
| 132 | +| **Header** | None | |
| 133 | +| **Library** | None | |
| 134 | +| **DLL** | httpapi.dll | |
| 135 | + |
| 136 | + |
| 137 | +## See also |
| 138 | + |
| 139 | +* [HttpSetRequestProperty](/windows/win32/api/http/nf-http-httpsetrequestproperty) |
| 140 | +* [HttpSetRequestQueueProperty](/windows/win32/api/http/nf-http-httpsetrequestqueueproperty) |
| 141 | +* [HttpSetServerSessionProperty](/windows/win32/api/http/nf-http-httpsetserversessionproperty) |
| 142 | +* [HttpSetServiceConfiguration](/windows/win32/api/http/nf-http-httpsetserviceconfiguration) |
| 143 | +* [HttpSetUrlGroupProperty](/windows/win32/api/http/nf-http-httpseturlgroupproperty) |
| 144 | +* [HttpQueryRequestQueueProperty](/windows/win32/api/http/nf-http-httpqueryrequestqueueproperty) |
| 145 | +* [HttpQueryServerSessionProperty](/windows/win32/api/http/nf-http-httpqueryserversessionproperty) |
| 146 | +* [HttpQueryServiceConfiguration](/windows/win32/api/http/nf-http-httpqueryserviceconfiguration) |
| 147 | +* [HttpQueryUrlGroupProperty](/windows/win32/api/http/nf-http-httpqueryurlgroupproperty) |
0 commit comments