void FCrashUpload::PostReportComplete() { if (PauseState == EUploadState::PostingReportComplete) { // Wait for confirmation SetCurrentState(EUploadState::WaitingToPostReportComplete); return; } AssignReportIdToPostDataBuffer(); auto Request = CreateHttpRequest(); Request->SetVerb( TEXT( "POST" ) ); Request->SetURL(UrlPrefix / TEXT("UploadComplete")); Request->SetHeader( TEXT( "Content-Type" ), TEXT( "text/plain; charset=us-ascii" ) ); Request->SetContent(PostData); UE_LOG( CrashReportClientLog, Log, TEXT( "Sending HTTP request: %s" ), *Request->GetURL() ); if (Request->ProcessRequest()) { SetCurrentState(EUploadState::PostingReportComplete); } else { CheckPendingReportsForFilesToUpload(); } }
bool FCrashUpload::SendCheckReportRequest() { FString XMLString; UE_LOG(CrashReportClientLog, Log, TEXT("Sending HTTP request (checking report)")); auto Request = CreateHttpRequest(); if (State == EUploadState::CheckingReport) { AssignReportIdToPostDataBuffer(); Request->SetURL(UrlPrefix / TEXT("CheckReport")); Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=us-ascii")); } else { // This part is Windows-specific on the server ErrorReport.LoadWindowsReportXmlFile( XMLString ); // Convert the XMLString into the UTF-8. FTCHARToUTF8 Converter( (const TCHAR*)*XMLString, XMLString.Len() ); const int32 Length = Converter.Length(); PostData.Reset( Length ); PostData.AddUninitialized( Length ); CopyAssignItems( (ANSICHAR*)PostData.GetData(), Converter.Get(), Length ); Request->SetURL(UrlPrefix / TEXT("CheckReportDetail")); Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=utf-8")); } UE_LOG( CrashReportClientLog, Log, TEXT( "PostData Num: %i" ), PostData.Num() ); Request->SetVerb(TEXT("POST")); Request->SetContent(PostData); return Request->ProcessRequest(); }