Http error on iOS (using AWS)

Seems like I’m being bitten from a iOS vs AWS incompatibility - the trouble is I don’t know how to work around it with minimal hassle (for instance, as a solo developer I don’t want to start modifying the engine code).

More detail from StackOverflow is here

In my case I’m also getting a warning about the “If-None-Match”. I’m going to look at deleting prior content before attempting the upload but it would be nice to know how to suppress these headers.

Looks like the NSMutableURLRequest is private within FAppleHttpRequest so I can’t see how to implement the solution on the SO thread…

FAppleHttpRequest::FAppleHttpRequest()
:	Connection(nullptr)
,	CompletionStatus(EHttpRequestStatus::NotStarted)
,	ProgressBytesSent(0)
,	StartRequestTime(0.0)
,	ElapsedTime(0.0f)
{
	UE_LOG(LogHttp, Verbose, TEXT("FAppleHttpRequest::FAppleHttpRequest()"));
	Request = [[NSMutableURLRequest alloc] init];
	Request.timeoutInterval = FHttpModule::Get().GetHttpTimeout();
}

Well - I solved it!

I created a whole new FttpRequest - a copy of FAppleHttpRequest (and the response) that makes the change needed. I create one of these in my code making the http request.

A whole load of code duplication here - if Request was protected, or exposed via an API function it would have been possible without so much ugliness. All that’s needed is a way to enable the last two lines in this function.

FIIOSRequest::FIIOSRequest()
:	Connection(nullptr)
,	CompletionStatus(EHttpRequestStatus::NotStarted)
,	ProgressBytesSent(0)
,	StartRequestTime(0.0)
,	ElapsedTime(0.0f)
{
	UE_LOG(LogHttp, Verbose, TEXT("FIIOSRequest::FIIOSRequest()"));
	Request = [[NSMutableURLRequest alloc] init];
	[Request setCachePolicy : NSURLRequestReloadIgnoringCacheData];
	Request.timeoutInterval = FHttpModule::Get().GetHttpTimeout();
}

This is no longer needed as it’s part of the platform apple HttpRequest.