> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HCHttpCallResponseSetDynamicSize

> Marks an HTTP call as having a dynamic-size response body for progress reporting.

# HCHttpCallResponseSetDynamicSize

Marks an HTTP call as having a dynamic-size response body for download progress reporting. Use this function when the number of bytes that your response body write function processes differs from the bytes received, and you know that total before the call starts. For example, if your write function decompresses data, you can report progress in decompressed bytes.

## Syntax

```cpp theme={null}
HRESULT HCHttpCallResponseSetDynamicSize(
         HCCallHandle call,
         uint64_t dynamicBodySize
)
```

### Parameters

*call*   \_In\_\
Type: HCCallHandle

The handle of the HTTP call.

*dynamicBodySize*   \_In\_\
Type: uint64\_t

The total size, in bytes, to use for progress reporting. Must be greater than 0.

### Return value

Type: HRESULT

| Value | Meaning |
| - | - |
| S\_OK | The size was set. |
| E\_INVALIDARG | `call` is `nullptr`, or `dynamicBodySize` is 0. |
| E\_HC\_PERFORM\_ALREADY\_CALLED | HCHttpCallPerformAsync was already called for this call. |
| E\_HC\_NOT\_INITIALISED | libHttpClient isn't initialized. |

## Remarks

Call this function before [HCHttpCallPerformAsync](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallperformasync.md). While the response downloads, report progress by calling [HCHttpCallResponseAddDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponseadddynamicbyteswritten.md), usually from the custom write function that you set with [HCHttpCallResponseSetResponseBodyWriteFunction](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallresponsesetresponsebodywritefunction.md).

If a download progress callback is registered and the response has a positive Content-Length, the built-in WinHTTP provider on Windows and XBOX consoles passes `dynamicBodySize` and the reported byte count to the callback instead of the network byte counts. Setting a dynamic size doesn't enable download progress for responses without a positive Content-Length. For the other callback restrictions, see [HCHttpCallProgressReportFunction](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallprogressreportfunction.md).

The reported byte count isn't reset if libHttpClient retries the call. For details, see [HCHttpCallResponseAddDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponseadddynamicbyteswritten.md).

For the request body, use [HCHttpCallRequestSetDynamicSize](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallrequestsetdynamicsize.md) and [HCHttpCallRequestAddDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallrequestadddynamicbyteswritten.md), which are declared in httpClient.h.

## Requirements

**Header:** httpProvider.h

**Library:** libHttpClient.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[httpProvider](https://docs.xbox.com/reference/live/httpclient/httpprovider/httpprovider_members.md)\
[HCHttpCallResponseAddDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponseadddynamicbyteswritten.md)\
[HCHttpCallResponseGetDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponsegetdynamicbyteswritten.md)


## Related topics

- [HCHttpCallResponseAddDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponseadddynamicbyteswritten.md)
- [HCHttpCallResponseGetDynamicBytesWritten](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponsegetdynamicbyteswritten.md)
- [httpProvider (contents)](https://docs.xbox.com/reference/live/httpclient/httpprovider/httpprovider_members.md)
- [HCHttpCallRequestSetDynamicSize](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hchttpcallrequestsetdynamicsize.md)
- [HCHttpCallResponseSetResponseBodyBytes](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hchttpcallresponsesetresponsebodybytes.md)
