2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2018-04-30 13:57:29 -04:00
|
|
|
|
|
|
|
|
#include "GenericPlatform/HttpRequestImpl.h"
|
2020-04-09 06:18:05 -04:00
|
|
|
#include "Stats/Stats.h"
|
2018-04-30 13:57:29 -04:00
|
|
|
#include "Http.h"
|
|
|
|
|
|
|
|
|
|
FHttpRequestCompleteDelegate& FHttpRequestImpl::OnProcessRequestComplete()
|
|
|
|
|
{
|
|
|
|
|
return RequestCompleteDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-03 15:03:57 -04:00
|
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
2018-04-30 13:57:29 -04:00
|
|
|
FHttpRequestProgressDelegate& FHttpRequestImpl::OnRequestProgress()
|
|
|
|
|
{
|
|
|
|
|
return RequestProgressDelegate;
|
|
|
|
|
}
|
2023-08-03 15:03:57 -04:00
|
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
|
|
|
|
|
|
|
|
FHttpRequestProgressDelegate64& FHttpRequestImpl::OnRequestProgress64()
|
|
|
|
|
{
|
|
|
|
|
return RequestProgressDelegate64;
|
|
|
|
|
}
|
2018-04-30 13:57:29 -04:00
|
|
|
|
2024-01-19 15:35:30 -05:00
|
|
|
FHttpRequestStatusCodeReceivedDelegate& FHttpRequestImpl::OnStatusCodeReceived()
|
|
|
|
|
{
|
|
|
|
|
return StatusCodeReceivedDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-30 13:57:29 -04:00
|
|
|
FHttpRequestHeaderReceivedDelegate& FHttpRequestImpl::OnHeaderReceived()
|
|
|
|
|
{
|
|
|
|
|
return HeaderReceivedDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-19 16:09:36 -05:00
|
|
|
FHttpRequestWillRetryDelegate& FHttpRequestImpl::OnRequestWillRetry()
|
|
|
|
|
{
|
|
|
|
|
return OnRequestWillRetryDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-23 16:08:08 -05:00
|
|
|
void FHttpRequestImpl::Shutdown()
|
|
|
|
|
{
|
|
|
|
|
OnProcessRequestComplete().Unbind();
|
|
|
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
|
|
|
|
OnRequestProgress().Unbind();
|
|
|
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
|
|
|
OnRequestProgress64().Unbind();
|
|
|
|
|
OnStatusCodeReceived().Unbind();
|
|
|
|
|
OnHeaderReceived().Unbind();
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-30 13:57:29 -04:00
|
|
|
void FHttpRequestImpl::BroadcastResponseHeadersReceived()
|
|
|
|
|
{
|
|
|
|
|
if (OnHeaderReceived().IsBound())
|
|
|
|
|
{
|
|
|
|
|
const FHttpResponsePtr Response = GetResponse();
|
|
|
|
|
if (Response.IsValid())
|
|
|
|
|
{
|
|
|
|
|
const FHttpRequestPtr ThisPtr(SharedThis(this));
|
|
|
|
|
const TArray<FString> AllHeaders = Response->GetAllHeaders();
|
|
|
|
|
for (const FString& Header : AllHeaders)
|
|
|
|
|
{
|
|
|
|
|
FString HeaderName;
|
|
|
|
|
FString HeaderValue;
|
|
|
|
|
if (Header.Split(TEXT(":"), &HeaderName, &HeaderValue))
|
|
|
|
|
{
|
|
|
|
|
HeaderValue.TrimStartInline();
|
2020-04-09 05:59:20 -04:00
|
|
|
|
|
|
|
|
QUICK_SCOPE_CYCLE_COUNTER(STAT_FHttpRequestImpl_BroadcastResponseHeadersReceived_OnHeaderReceived);
|
2018-04-30 13:57:29 -04:00
|
|
|
OnHeaderReceived().ExecuteIfBound(ThisPtr, HeaderName, HeaderValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|