Files
UnrealEngineUWP/Engine/Source/Runtime/Online/HTTP/Private/GenericPlatform/HttpRequestImpl.cpp
James Hopkin 2addd2c688 Copying //UE4/Dev-Online to //UE4/Dev-Main (Source: //UE4/Dev-Online @ 4040378)
#lockdown Nick.Penwarden

============================
  MAJOR FEATURES & CHANGES
============================

Change 3661955 by Rob.Cannaday

	Change access pattern to FHttpThread to remove critical section
	#http #ue4

Change 3672463 by Rob.Cannaday

	Revert Curl/WinINet HTTP implementation of GetHeader/GetAllHeaders to not allowing access until the request is complete
	Some optimizations to Curl/WinINet GetAllHeaders
	Add bIsAsyncProcessingFinished to FHttpResponseWinInet, set when the request is finished on the HTTP thread, and only set bIsReady when we have finished processing all received headers
	Use FThreadSafeBool instead of volatile int32 in WinINet HTTP

Change 3855724 by Michael.Kirzinger

	Fix include paths

Change 3949903 by Ian.Fox

	#OnlineSubsystemSteam - Add IsValid check to SteamSessionInfo to fix a rare crash
	- Misc cleanup / casting fixes
	#github #4532

Change 3949914 by Ian.Fox

	#ShooterGame - Wait for session creation to finish before cleaning up session on network errors
	#review-3831601

Change 3662317 by Rob.Cannaday

	Add delegate for when we receive an http header
	Add FHttpRequestImpl to implement simple virtual functions that all platforms implement in the same way
	Add lock access to Curl/WinInet response headers access so game thread can safely read while processing
	#jira OGS-832
	#jira OGS-833
	#http #ue4

#rb none

[CL 4040611 by James Hopkin in Main branch]
2018-04-30 13:57:29 -04:00

46 lines
1.3 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "GenericPlatform/HttpRequestImpl.h"
#include "Http.h"
FHttpRequestCompleteDelegate& FHttpRequestImpl::OnProcessRequestComplete()
{
UE_LOG(LogHttp, VeryVerbose, TEXT("FHttpRequestImpl::OnProcessRequestComplete()"));
return RequestCompleteDelegate;
}
FHttpRequestProgressDelegate& FHttpRequestImpl::OnRequestProgress()
{
UE_LOG(LogHttp, VeryVerbose, TEXT("FHttpRequestImpl::OnRequestProgress()"));
return RequestProgressDelegate;
}
FHttpRequestHeaderReceivedDelegate& FHttpRequestImpl::OnHeaderReceived()
{
UE_LOG(LogHttp, VeryVerbose, TEXT("FHttpRequestImpl::OnHeaderReceived()"));
return HeaderReceivedDelegate;
}
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();
OnHeaderReceived().ExecuteIfBound(ThisPtr, HeaderName, HeaderValue);
}
}
}
}
}