本文整理汇总了C++中FHttpResponsePtr::GetHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ FHttpResponsePtr::GetHeader方法的具体用法?C++ FHttpResponsePtr::GetHeader怎么用?C++ FHttpResponsePtr::GetHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FHttpResponsePtr
的用法示例。
在下文中一共展示了FHttpResponsePtr::GetHeader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HttpStartDownloadingFinished
void FHttpNetworkReplayStreamer::HttpStartDownloadingFinished( FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded )
{
check( HttpState == EHttptate::StartDownloading );
check( StreamerState == EStreamerState::NeedToDownloadHeader );
HttpState = EHttptate::Idle;
if ( bSucceeded && HttpResponse->GetResponseCode() == EHttpResponseCodes::Ok )
{
FString NumChunksString = HttpResponse->GetHeader( TEXT( "NumChunks" ) );
FString DemoTimeString = HttpResponse->GetHeader( TEXT( "Time" ) );
FString State = HttpResponse->GetHeader( TEXT( "State" ) );
ViewerName = HttpResponse->GetHeader( TEXT( "Viewer" ) );
bStreamIsLive = State == TEXT( "Live" );
NumDownloadChunks = FCString::Atoi( *NumChunksString );
DemoTimeInMS = FCString::Atoi( *DemoTimeString );
UE_LOG( LogHttpReplay, Log, TEXT( "FHttpNetworkReplayStreamer::HttpStartDownloadingFinished. Viewer: %s, State: %s, NumChunks: %i, DemoTime: %2.2f" ), *ViewerName, *State, NumDownloadChunks, (float)DemoTimeInMS / 1000 );
// First, download the header
if ( NumDownloadChunks > 0 )
{
StreamerState = EStreamerState::NeedToDownloadHeader;
}
else
{
UE_LOG( LogHttpReplay, Warning, TEXT( "FHttpNetworkReplayStreamer::HttpStartDownloadingFinished. NO CHUNKS" ) );
StartStreamingDelegate.ExecuteIfBound( false, StreamArchive.IsSaving() );
// Reset delegate
StartStreamingDelegate = FOnStreamReadyDelegate();
SetLastError( ENetworkReplayError::ServiceUnavailable );
}
}
else
{
UE_LOG( LogHttpReplay, Error, TEXT( "FHttpNetworkReplayStreamer::HttpStartDownloadingFinished. FAILED" ) );
StartStreamingDelegate.ExecuteIfBound( false, StreamArchive.IsSaving() );
// Reset delegate
StartStreamingDelegate = FOnStreamReadyDelegate();
SetLastError( ENetworkReplayError::ServiceUnavailable );
}
}
示例2: ParseRequestIdFromResponse
int HttpRpcRequest::ParseRequestIdFromResponse(FHttpResponsePtr response) {
FString requestIdString = response->GetHeader("X-Request-ID");
if (requestIdString == "") {
return -1;
}
return FCString::Atoi(*requestIdString);
}
示例3: HttpDownloadFinished
void FHttpNetworkReplayStreamer::HttpDownloadFinished( FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded )
{
check( HttpState == EHttptate::DownloadingStream );
check( StreamArchive.IsLoading() );
HttpState = EHttptate::Idle;
if ( bSucceeded && HttpResponse->GetResponseCode() == EHttpResponseCodes::Ok )
{
FString NumChunksString = HttpResponse->GetHeader( TEXT( "NumChunks" ) );
FString DemoTimeString = HttpResponse->GetHeader( TEXT( "Time" ) );
FString State = HttpResponse->GetHeader( TEXT( "State" ) );
bStreamIsLive = State == TEXT( "Live" );
NumDownloadChunks = FCString::Atoi( *NumChunksString );
DemoTimeInMS = FCString::Atoi( *DemoTimeString );
if ( HttpResponse->GetContent().Num() > 0 || bStreamIsLive )
{
if ( HttpResponse->GetContent().Num() > 0 )
{
StreamArchive.Buffer.Append( HttpResponse->GetContent() );
StreamFileCount++;
}
UE_LOG( LogHttpReplay, Verbose, TEXT( "FHttpNetworkReplayStreamer::HttpDownloadFinished. State: %s, Progress: %i / %i, DemoTime: %2.2f" ), *State, StreamFileCount, NumDownloadChunks, (float)DemoTimeInMS / 1000 );
}
else
{
UE_LOG( LogHttpReplay, Error, TEXT( "FHttpNetworkReplayStreamer::HttpDownloadFinished. FAILED." ) );
StreamArchive.Buffer.Empty();
SetLastError( ENetworkReplayError::ServiceUnavailable );
}
}
else
{
UE_LOG( LogHttpReplay, Error, TEXT( "FHttpNetworkReplayStreamer::HttpDownloadFinished. FAILED." ) );
StreamArchive.Buffer.Empty();
SetLastError( ENetworkReplayError::ServiceUnavailable );
}
}
示例4: HandleHeaderReceived
void UBPDownloader::HandleHeaderReceived(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded)
{
if (bSucceeded && HttpResponse.IsValid())
{
FString FileLength = HttpResponse->GetHeader(L"Content-Length");// ();
FileTotalBytes = (float)UKismetStringLibrary::Conv_StringToInt(FileLength);
//Start Downloading
StartDownload();
}
else
{
RemoveFromRoot();
OnFail.Broadcast(0.f);//FilePath
}
}
示例5: HttpStartUploadingFinished
void FHttpNetworkReplayStreamer::HttpStartUploadingFinished( FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded )
{
check( HttpState == EHttptate::StartUploading );
check( StreamerState == EStreamerState::NeedToUploadHeader );
HttpState = EHttptate::Idle;
if ( bSucceeded && HttpResponse->GetResponseCode() == EHttpResponseCodes::Ok )
{
SessionName = HttpResponse->GetHeader( TEXT( "Session" ) );
UE_LOG( LogHttpReplay, Log, TEXT( "FHttpNetworkReplayStreamer::HttpStartUploadingFinished. SessionName: %s" ), *SessionName );
}
else
{
UE_LOG( LogHttpReplay, Error, TEXT( "FHttpNetworkReplayStreamer::HttpStartUploadingFinished. FAILED" ) );
SetLastError( ENetworkReplayError::ServiceUnavailable );
}
}