UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GenericPlatformHttp.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4#pragma once
5
6#include "Containers/Array.h"
7#include "Containers/Set.h"
11#include "CoreMinimal.h"
12#include "HAL/Platform.h"
13#include "Misc/Optional.h"
14
15class FHttpManager;
16class IHttpRequest;
17
22{
23public:
25
26 // Build the user agent string. Passing a filter will limit the comments to only those allowed.
27 // Passing nullptr for a filter implies that all comments are allowed.
29
30 HTTP_API void SetProjectName(const FString& InProjectName);
31 HTTP_API void SetProjectVersion(const FString& InProjectVersion);
32 HTTP_API void AddProjectComment(const FString& InComment);
33 HTTP_API void SetPlatformName(const FString& InPlatformName);
35 HTTP_API void AddPlatformComment(const FString& InComment);
36
37 // Get the builder version. The version is used for tracking app changes to the default user
38 // agent and is not included in the user agent string.
40
41private:
42 static FString BuildCommentString(const TArray<FString>& Comments, const TSet<FString>* AllowedCommentsFilter);
43
44 FString ProjectName;
45 FString ProjectVersion;
46 TArray<FString> ProjectComments;
47 FString PlatformName;
48 FString PlatformVersion;
49 TArray<FString> PlatformComments;
50 uint32 AgentVersion;
51};
52
58{
59public:
60
64 static HTTP_API void Init();
65
72 {
73 return nullptr;
74 }
75
79 static HTTP_API void Shutdown();
80
85
92
99 static HTTP_API FString UrlEncode(const FStringView UnencodedString);
100
107 static HTTP_API FString UrlDecode(const FStringView EncodedString);
108
115 static HTTP_API FString HtmlEncode(const FStringView UnencodedString);
116
122 static HTTP_API FString GetUrlDomainAndPort(const FStringView Url);
123
129 static HTTP_API FString GetUrlDomain(const FStringView Url);
130
136 static HTTP_API FString GetUrlBase(const FStringView Url);
137
142 static HTTP_API FString GetMimeType(const FString& FilePath);
143
152 static HTTP_API FString GetDefaultUserAgent();
153 static HTTP_API FString EscapeUserAgentString(const FString& UnescapedString);
154
158 static HTTP_API void AddDefaultUserAgentProjectComment(const FString& Comment);
159
163 static HTTP_API void AddDefaultUserAgentPlatformComment(const FString& Comment);
164
172
178
191
200
204 static HTTP_API bool IsURLEncoded(const TArray<uint8>& Payload);
205
213 static HTTP_API TOptional<FString> GetUrlParameter(const FStringView Url, const FStringView ParameterName);
214
221
231 static HTTP_API FString GetUrlPath(const FStringView Url, const bool bIncludeQueryString = false, const bool bIncludeFragment = false);
232
240};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition GenericPlatformHttp.h:22
HTTP_API void AddProjectComment(const FString &InComment)
Definition GenericPlatformHttp.cpp:186
HTTP_API void SetProjectVersion(const FString &InProjectVersion)
Definition GenericPlatformHttp.cpp:180
HTTP_API FString BuildUserAgentString(const TSet< FString > *AllowedProjectCommentsFilter=nullptr, const TSet< FString > *AllowedPlatformCommentsFilter=nullptr) const
Definition GenericPlatformHttp.cpp:162
HTTP_API uint32 GetAgentVersion() const
Definition GenericPlatformHttp.cpp:210
HTTP_API void AddPlatformComment(const FString &InComment)
Definition GenericPlatformHttp.cpp:204
HTTP_API void SetProjectName(const FString &InProjectName)
Definition GenericPlatformHttp.cpp:174
HTTP_API void SetPlatformName(const FString &InPlatformName)
Definition GenericPlatformHttp.cpp:192
HTTP_API void SetPlatformVersion(const FString &InPlatformVersion)
Definition GenericPlatformHttp.cpp:198
HTTP_API FDefaultUserAgentBuilder()
Definition GenericPlatformHttp.cpp:144
Definition GenericPlatformHttp.h:58
static HTTP_API FString UrlDecode(const FStringView EncodedString)
Definition GenericPlatformHttp.cpp:383
static HTTP_API void AddDefaultUserAgentPlatformComment(const FString &Comment)
Definition GenericPlatformHttp.cpp:593
static HTTP_API FString GetUrlBase(const FStringView Url)
Definition GenericPlatformHttp.cpp:516
static HTTP_API FString GetUrlPath(const FStringView Url, const bool bIncludeQueryString=false, const bool bIncludeFragment=false)
Definition GenericPlatformHttp.cpp:767
static HTTP_API FString HtmlEncode(const FStringView UnencodedString)
Definition GenericPlatformHttp.cpp:449
static HTTP_API FString GetDefaultUserAgent()
Definition GenericPlatformHttp.cpp:583
static HTTP_API uint32 GetDefaultUserAgentVersion()
Definition GenericPlatformHttp.cpp:598
static HTTP_API FString GetUrlDomain(const FStringView Url)
Definition GenericPlatformHttp.cpp:493
static HTTP_API bool IsURLEncoded(const TArray< uint8 > &Payload)
Definition HttpRequestPayload.cpp:10
static HTTP_API FString GetUrlDomainAndPort(const FStringView Url)
Definition GenericPlatformHttp.cpp:470
static FHttpManager * CreatePlatformHttpManager()
Definition GenericPlatformHttp.h:71
static HTTP_API void Shutdown()
Definition GenericPlatformHttp.cpp:317
static HTTP_API TOptional< bool > IsSecureProtocol(const FStringView Url)
Definition GenericPlatformHttp.cpp:887
static HTTP_API FDefaultUserAgentBuilder GetDefaultUserAgentBuilder()
Definition GenericPlatformHttp.cpp:603
static HTTP_API void Init()
Definition GenericPlatformHttp.cpp:311
static HTTP_API bool IsOperatingSystemProxyInformationSupported()
Definition GenericPlatformHttp.cpp:628
static HTTP_API TOptional< FString > GetUrlParameter(const FStringView Url, const FStringView ParameterName)
Definition GenericPlatformHttp.cpp:633
static HTTP_API IHttpRequest * ConstructRequest()
Definition GenericPlatformHttp.cpp:321
static void ShutdownPlatformCustomSsl()
Definition GenericPlatformHttp.h:84
static HTTP_API FString GetMimeType(const FString &FilePath)
Definition GenericPlatformHttp.cpp:532
static HTTP_API TOptional< FString > GetOperatingSystemProxyAddress()
Definition GenericPlatformHttp.cpp:623
static HTTP_API TOptional< uint16 > GetUrlPort(const FStringView Url)
Definition GenericPlatformHttp.cpp:702
static HTTP_API void AddDefaultUserAgentProjectComment(const FString &Comment)
Definition GenericPlatformHttp.cpp:588
static HTTP_API FString EscapeUserAgentString(const FString &UnescapedString)
Definition GenericPlatformHttp.cpp:608
static HTTP_API FString UrlEncode(const FStringView UnencodedString)
Definition GenericPlatformHttp.cpp:347
Definition HttpManager.h:116
Definition IHttpRequest.h:171
Definition Array.h:670
Definition Optional.h:131