UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FHttpManager Class Reference

#include <HttpManager.h>

+ Inheritance diagram for FHttpManager:

Classes

struct  FHttpFlushTimeLimit
 
struct  FHttpStatsHistory
 
struct  FUrlToMatch
 

Public Member Functions

HTTP_API FHttpManager ()
 
virtual HTTP_API ~FHttpManager ()
 
HTTP_API void Initialize ()
 
HTTP_API void Shutdown ()
 
HTTP_API void SetRequestAddedDelegate (const FHttpManagerRequestAddedDelegate &Delegate)
 
HTTP_API void SetRequestCompletedDelegate (const FHttpManagerRequestCompletedDelegate &Delegate)
 
HTTP_API void RemoveRequest (const FHttpRequestRef &Request)
 
HTTP_API bool IsValidRequest (const IHttpRequest *RequestPtr) const
 
HTTP_API void Flush (EHttpFlushReason FlushReason)
 
HTTP_API bool Tick (float DeltaSeconds) override
 
virtual HTTP_API void FlushTick (float DeltaSeconds)
 
HTTP_API void AddThreadedRequest (const TSharedRef< FHttpRequestCommon, ESPMode::ThreadSafe > &Request)
 
HTTP_API void CancelThreadedRequest (const TSharedRef< FHttpRequestCommon, ESPMode::ThreadSafe > &Request)
 
HTTP_API void DumpRequests (FOutputDevice &Ar) const
 
virtual HTTP_API bool SupportsDynamicProxy () const
 
HTTP_API void SetCorrelationIdMethod (TFunction< FString()> InCorrelationIdMethod)
 
HTTP_API FString CreateCorrelationId () const
 
HTTP_API bool IsDomainAllowed (const FString &Url) const
 
virtual HTTP_API void OnBeforeFork ()
 
virtual HTTP_API void OnAfterFork ()
 
virtual HTTP_API void OnEndFramePostFork ()
 
virtual HTTP_API void UpdateConfigs ()
 
HTTP_API void AddGameThreadTask (TFunction< void()> &&Task, float Delay=0.0f)
 
HTTP_API TSharedPtr< IHttpTaskTimerHandleAddHttpThreadTask (TFunction< void()> &&Task, float InDelay=0.0f)
 
HTTP_API void RemoveHttpThreadTask (TSharedPtr< IHttpTaskTimerHandle > HttpTaskTimerHandle)
 
void SetURLRequestFilter (const UE::Core::FURLRequestFilter &InURLRequestFilter)
 
FHttpStats GetHttpStats () const
 
- Public Member Functions inherited from FTSTickerObjectBase
 UE_NONCOPYABLE (FTSTickerObjectBase)
 
CORE_API FTSTickerObjectBase (float InDelay=0.0f, FTSTicker &Ticker=FTSTicker::GetCoreTicker())
 
virtual CORE_API ~FTSTickerObjectBase ()
 

Static Public Member Functions

static HTTP_API TFunction< FString()> GetDefaultCorrelationIdMethod ()
 

Protected Member Functions

virtual HTTP_API FHttpThreadBaseCreateHttpThread ()
 
HTTP_API void ReloadFlushTimeLimits ()
 
HTTP_API bool HasAnyBoundDelegate () const
 
HTTP_API void UpdateUrlPatternsToLogResponse (IConsoleVariable *CVar)
 
HTTP_API void UpdateUrlPatternsToDisableFailedLog (IConsoleVariable *CVar)
 
HTTP_API void UpdateUrlPatternsToMockResponse (IConsoleVariable *CVar)
 
HTTP_API void BroadcastHttpRequestCompleted (const FHttpRequestRef &Request)
 
HTTP_API FHttpThreadBaseGetThread ()
 
HTTP_API void RecordStatTimeToConnect (float Duration)
 
HTTP_API void RecordStatRequestsInFlight (uint32 RequestsInFlight)
 
HTTP_API void RecordStatRequestsInQueue (uint32 RequestsInQueue)
 
HTTP_API void RecordMaxTimeToWaitInQueue (float Duration)
 
HTTP_API void RecordPlatformStats (const FHttpStatsPlatform &PlatformStats)
 
HTTP_API bool ShouldLogResponse (FStringView Url) const
 
HTTP_API bool ShouldDisableFailedLog (FStringView Url) const
 
HTTP_API TOptional< FMockResponseGetMockResponse (FStringView Url, FStringView Verb) const
 
HTTP_API void MarkCurrentThreadCompletingRequest (bool bCompleting)
 
HTTP_API bool IsCurrentThreadCompletingRequest () const
 
HTTP_API void AddRequest (const FHttpRequestRef &Request)
 

Protected Attributes

TArray< FHttpRequestRefRequests
 
FHttpThreadBaseThread
 
TFunction< FString()> CorrelationIdMethod
 
FTSTicker GameThreadTicker
 
FCriticalSection GameThreadTickerLock
 
bool bFlushing
 
FHttpManagerRequestAddedDelegate RequestAddedDelegate
 
FHttpManagerRequestCompletedDelegate RequestCompletedDelegate
 
UE::Core::FURLRequestFilter URLRequestFilter
 
TMap< EHttpFlushReason, FHttpFlushTimeLimitFlushTimeLimitsMap
 
FHttpStats HttpStats
 
FHttpStatsHistory HttpStatsHistory
 
bool bUseEventLoop = true
 
TArray< FString > UrlPatternsToLogResponse
 
FCriticalSection UrlPatternsToLogResponseCriticalSection
 
TArray< FString > UrlPatternsToDisableFailedLog
 
FCriticalSection UrlPatternsToDisableFailedLogCriticalSection
 
FCriticalSection ThreadsCompletingRequestCriticalSection
 
TMap< uint32, boolThreadsCompletingRequest
 
PACKAGE_SCOPE : struct FMockResponse { int32 StatusCode = 0
 
FUtf8String ResponsePayload
 
TMap< FString, FString > ResponseHeaders
 
FCriticalSection RequestLock
 
FCriticalSection CompletedRequestLock
 
TArray< TPair< FUrlToMatch, FMockResponse > > UrlPatternsToMockResponse
 
FCriticalSection UrlPatternsToMockResponseCriticalSection
 

Detailed Description

Manages Http request that are currently being processed

Constructor & Destructor Documentation

◆ FHttpManager()

PRAGMA_DISABLE_DEPRECATION_WARNINGS FHttpManager::FHttpManager ( )

Constructor

◆ ~FHttpManager()

FHttpManager::~FHttpManager ( )
virtual

Destructor

Member Function Documentation

◆ AddGameThreadTask()

void FHttpManager::AddGameThreadTask ( TFunction< void()> &&  Task,
float  Delay = 0.0f 
)

Add task to be ran on the game thread next tick

Parameters
TaskThe task to be ran next tick

◆ AddHttpThreadTask()

TSharedPtr< IHttpTaskTimerHandle > FHttpManager::AddHttpThreadTask ( TFunction< void()> &&  Task,
float  InDelay = 0.0f 
)

Add task to be ran on the http thread

Parameters
TaskThe task to be ran
InDelayThe delay to wait before running the task
Returns
The handle of the timer, which could be used to remove the task before it's triggered

◆ AddRequest()

void FHttpManager::AddRequest ( const FHttpRequestRef Request)
protected

Add a http request to the manager without enqueueing the threaded execution

Parameters
Request- the request object to add

◆ AddThreadedRequest()

void FHttpManager::AddThreadedRequest ( const TSharedRef< FHttpRequestCommon, ESPMode::ThreadSafe > &  Request)

Add a http request to be executed on the http thread

Parameters
Request- the request object to add

◆ BroadcastHttpRequestCompleted()

void FHttpManager::BroadcastHttpRequestCompleted ( const FHttpRequestRef Request)
protected

Broadcast that a non-threaded HTTP request is complete. Called automatically internally for threaded requests. Called explicitly by non-threaded requests

◆ CancelThreadedRequest()

void FHttpManager::CancelThreadedRequest ( const TSharedRef< FHttpRequestCommon, ESPMode::ThreadSafe > &  Request)

Mark a threaded http request as cancelled to be removed from the http thread

Parameters
Request- the request object to cancel

◆ CreateCorrelationId()

FString FHttpManager::CreateCorrelationId ( ) const

Create a new correlation id for a request

Returns
The new correlationid string

◆ CreateHttpThread()

FHttpThreadBase * FHttpManager::CreateHttpThread ( )
protectedvirtual

Create HTTP thread object

Returns
the HTTP thread object

Reimplemented in FAppleHttpManager.

◆ DumpRequests()

void FHttpManager::DumpRequests ( FOutputDevice Ar) const

List all of the Http requests currently being processed

Parameters
Ar- output device to log with

◆ Flush()

void FHttpManager::Flush ( EHttpFlushReason  FlushReason)

Block until all pending requests are finished processing

Parameters
FlushReasonthe flush reason will influence times waited to cancel ongoing http requests

◆ FlushTick()

void FHttpManager::FlushTick ( float  DeltaSeconds)
virtual

Tick called during Flush

Parameters
DeltaSeconds- time in seconds since the last tick

◆ GetDefaultCorrelationIdMethod()

TFunction< FString()> FHttpManager::GetDefaultCorrelationIdMethod ( )
static

Get the default method for creating new correlation ids for a request

Returns
The default correlationid creation method

◆ GetHttpStats()

FHttpStats FHttpManager::GetHttpStats ( ) const
inline

◆ GetMockResponse()

TOptional< FHttpManager::FMockResponse > FHttpManager::GetMockResponse ( FStringView  Url,
FStringView  Verb 
) const
protected

◆ GetThread()

FHttpThreadBase * FHttpManager::GetThread ( )
protected

Access http thread of http manager for internal usage

◆ HasAnyBoundDelegate()

bool FHttpManager::HasAnyBoundDelegate ( ) const
protected

◆ Initialize()

PRAGMA_ENABLE_DEPRECATION_WARNINGS void FHttpManager::Initialize ( )

Initialize

◆ IsCurrentThreadCompletingRequest()

bool FHttpManager::IsCurrentThreadCompletingRequest ( ) const
protected

◆ IsDomainAllowed()

bool FHttpManager::IsDomainAllowed ( const FString &  Url) const

Determine if the domain is allowed to be accessed

Parameters
Urlthe path to check domain on
Returns
true if domain is allowed

◆ IsValidRequest()

bool FHttpManager::IsValidRequest ( const IHttpRequest RequestPtr) const

Find an Http request in the lists of current valid requests

Parameters
RequestPtr- ptr to the http request object to find
Returns
true if the request is being tracked, false if not

◆ MarkCurrentThreadCompletingRequest()

void FHttpManager::MarkCurrentThreadCompletingRequest ( bool  bCompleting)
protected

◆ OnAfterFork()

void FHttpManager::OnAfterFork ( )
virtual

Inform that HTTP Manager that we have completed a fork(). Must be called in both the client and parent process

◆ OnBeforeFork()

void FHttpManager::OnBeforeFork ( )
virtual

Inform that HTTP Manager that we are about to fork(). Will block to flush all outstanding http requests

◆ OnEndFramePostFork()

void FHttpManager::OnEndFramePostFork ( )
virtual

Inform the HTTP Manager that we finished ticking right after forking. Only called on the forked process

◆ RecordMaxTimeToWaitInQueue()

void FHttpManager::RecordMaxTimeToWaitInQueue ( float  Duration)
protected

Record the time to wait in queue, to have a general idea how long the client usually wait before actually starting, to adjust the requests

◆ RecordPlatformStats()

void FHttpManager::RecordPlatformStats ( const FHttpStatsPlatform PlatformStats)
protected

Record platform specific stats

◆ RecordStatRequestsInFlight()

void FHttpManager::RecordStatRequestsInFlight ( uint32  RequestsInFlight)
protected

Record the requests waiting in flight, to have an idea if there are too many concurrent requests

◆ RecordStatRequestsInQueue()

void FHttpManager::RecordStatRequestsInQueue ( uint32  RequestsInQueue)
protected

Record the requests waiting in queue, to have an idea if there are too many requests or if request number limit is too small

◆ RecordStatTimeToConnect()

void FHttpManager::RecordStatTimeToConnect ( float  Duration)
protected

Record the time to connect, to have a general idea how long the client usually take to connect for success requests, to adjust the connection timeout

◆ ReloadFlushTimeLimits()

void FHttpManager::ReloadFlushTimeLimits ( )
protected

◆ RemoveHttpThreadTask()

void FHttpManager::RemoveHttpThreadTask ( TSharedPtr< IHttpTaskTimerHandle HttpTaskTimerHandle)

Remove the task from the http thread before it's triggered

Parameters
HttpTaskTimerHandleThe handle of the timer

◆ RemoveRequest()

void FHttpManager::RemoveRequest ( const FHttpRequestRef Request)

Removes an Http request instance from the manager Presumably it is done being processed

Parameters
Request- the request object to remove

◆ SetCorrelationIdMethod()

void FHttpManager::SetCorrelationIdMethod ( TFunction< FString()>  InCorrelationIdMethod)

Set the method used to set a Correlation id on each request, if one is not already specified.

This method allows you to override the Engine default method.

Parameters
InCorrelationIdMethodThe method to use when sending a request, if no Correlation id is already set

◆ SetRequestAddedDelegate()

void FHttpManager::SetRequestAddedDelegate ( const FHttpManagerRequestAddedDelegate Delegate)

Set a delegate to be triggered when an http request added to http manager. NOTE: The delegate can be triggered from different threads, depends on which thread the request created. So make sure the delegate set here is thread-safe.

◆ SetRequestCompletedDelegate()

void FHttpManager::SetRequestCompletedDelegate ( const FHttpManagerRequestCompletedDelegate Delegate)

Set a delegate to be triggered when an http request completed. NOTE: The delegate can be triggered from different threads, it depends on the delegate policy set to each http request. So make sure the delegate set here is thread-safe.

◆ SetURLRequestFilter()

void FHttpManager::SetURLRequestFilter ( const UE::Core::FURLRequestFilter InURLRequestFilter)
inline

Set url request filter through code, instead of setting it through config.

Parameters
InURLRequestFilterThe request filter to set

◆ ShouldDisableFailedLog()

bool FHttpManager::ShouldDisableFailedLog ( FStringView  Url) const
protected

◆ ShouldLogResponse()

bool FHttpManager::ShouldLogResponse ( FStringView  Url) const
protected

◆ Shutdown()

void FHttpManager::Shutdown ( )

Shutdown logic should be called before quiting

◆ SupportsDynamicProxy()

bool FHttpManager::SupportsDynamicProxy ( ) const
virtual

Method to check dynamic proxy setting support.

Returns
Whether this http implementation supports dynamic proxy setting.

◆ Tick()

bool FHttpManager::Tick ( float  DeltaSeconds)
overridevirtual

FTSTicker callback

Parameters
DeltaSeconds- time in seconds since the last tick
Returns
false if no longer needs ticking

Implements FTSTickerObjectBase.

◆ UpdateConfigs()

void FHttpManager::UpdateConfigs ( )
virtual

Update configuration. Called when config has been updated and we need to apply any changes.

◆ UpdateUrlPatternsToDisableFailedLog()

void FHttpManager::UpdateUrlPatternsToDisableFailedLog ( IConsoleVariable CVar)
protected

◆ UpdateUrlPatternsToLogResponse()

void FHttpManager::UpdateUrlPatternsToLogResponse ( IConsoleVariable CVar)
protected

◆ UpdateUrlPatternsToMockResponse()

void FHttpManager::UpdateUrlPatternsToMockResponse ( IConsoleVariable CVar)
protected

Member Data Documentation

◆ __pad0__

PACKAGE_SCOPE FHttpManager::__pad0__
protected

◆ bFlushing

bool FHttpManager::bFlushing
protected

◆ bUseEventLoop

bool FHttpManager::bUseEventLoop = true
protected

◆ CompletedRequestLock

FCriticalSection FHttpManager::CompletedRequestLock
protected

Used to lock access to get completed requests

◆ CorrelationIdMethod

TFunction<FString()> FHttpManager::CorrelationIdMethod
protected

This method will be called to generate a CorrelationId on all requests being sent if one is not already set

◆ FlushTimeLimitsMap

TMap<EHttpFlushReason, FHttpFlushTimeLimit> FHttpManager::FlushTimeLimitsMap
protected

◆ GameThreadTicker

FTSTicker FHttpManager::GameThreadTicker
protected

Ticker to run game thread tasks

◆ GameThreadTickerLock

FCriticalSection FHttpManager::GameThreadTickerLock
protected

◆ HttpStats

FHttpStats FHttpManager::HttpStats
protected

◆ HttpStatsHistory

FHttpStatsHistory FHttpManager::HttpStatsHistory
protected

◆ RequestAddedDelegate

FHttpManagerRequestAddedDelegate FHttpManager::RequestAddedDelegate
protected

Delegate that will get called once request added

◆ RequestCompletedDelegate

FHttpManagerRequestCompletedDelegate FHttpManager::RequestCompletedDelegate
protected

Delegate that will get called when a request completes

◆ RequestLock

FCriticalSection FHttpManager::RequestLock
mutableprotected

Used to lock access to add/remove/find requests

◆ Requests

TArray<FHttpRequestRef> FHttpManager::Requests
protected

List of Http requests that are actively being processed

◆ ResponseHeaders

TMap<FString, FString> FHttpManager::ResponseHeaders
protected

◆ ResponsePayload

FUtf8String FHttpManager::ResponsePayload
protected

◆ Thread

FHttpThreadBase* FHttpManager::Thread
protected

◆ ThreadsCompletingRequest

TMap<uint32, bool> FHttpManager::ThreadsCompletingRequest
protected

◆ ThreadsCompletingRequestCriticalSection

FCriticalSection FHttpManager::ThreadsCompletingRequestCriticalSection
mutableprotected

◆ UrlPatternsToDisableFailedLog

TArray<FString> FHttpManager::UrlPatternsToDisableFailedLog
protected

◆ UrlPatternsToDisableFailedLogCriticalSection

FCriticalSection FHttpManager::UrlPatternsToDisableFailedLogCriticalSection
mutableprotected

◆ UrlPatternsToLogResponse

TArray<FString> FHttpManager::UrlPatternsToLogResponse
protected

◆ UrlPatternsToLogResponseCriticalSection

FCriticalSection FHttpManager::UrlPatternsToLogResponseCriticalSection
mutableprotected

◆ UrlPatternsToMockResponse

TArray<TPair<FUrlToMatch, FMockResponse> > FHttpManager::UrlPatternsToMockResponse
protected

◆ UrlPatternsToMockResponseCriticalSection

FCriticalSection FHttpManager::UrlPatternsToMockResponseCriticalSection
mutableprotected

◆ URLRequestFilter

UE::Core::FURLRequestFilter FHttpManager::URLRequestFilter
protected

Url request filter, if specified in the config, it will launch http request only when the url is in the allowlist


The documentation for this class was generated from the following files: