http.CurlDebugServerResponseEnabled

http.CurlDebugServerResponseEnabled

#Overview

name: http.CurlDebugServerResponseEnabled

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of http.CurlDebugServerResponseEnabled is to enable debugging of server responses in the HTTP module of Unreal Engine, specifically for the CURL implementation.

This setting variable is primarily used in the HTTP module, which is part of the Online subsystem in Unreal Engine. It is specifically utilized in the CURL implementation of HTTP requests.

The value of this variable is set through a console variable (CVar) system. It is initialized as false by default, but can be changed at runtime through console commands or configuration files.

The associated variable CVarCurlDebugServerResponseEnabled directly interacts with http.CurlDebugServerResponseEnabled. They share the same value and purpose.

Developers must be aware that this variable is specifically used for debugging server responses. It’s particularly useful when dealing with server errors (HTTP status codes 500-503). When enabled, it will provide more detailed logging information about these error responses.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging, as it may impact performance.
  2. Be cautious about using it in production environments, as it may expose sensitive information in logs.
  3. Use it in conjunction with other debugging tools and logs to get a comprehensive view of HTTP-related issues.
  4. Remember to disable it after debugging to prevent unnecessary logging.

Regarding the associated variable CVarCurlDebugServerResponseEnabled:

This is an auto console variable of type bool, which directly corresponds to the http.CurlDebugServerResponseEnabled setting. It’s used internally in the code to check the current state of the debug setting.

The purpose of CVarCurlDebugServerResponseEnabled is to provide a programmatic way to access the value of http.CurlDebugServerResponseEnabled within the C++ code.

It’s primarily used in the FCurlHttpRequest::FinishRequest function to determine whether to perform additional debugging for server responses with status codes 500-503.

Developers should be aware that changing the value of http.CurlDebugServerResponseEnabled will directly affect the behavior controlled by CVarCurlDebugServerResponseEnabled. There’s no need to modify both separately; they are intrinsically linked.

Best practices for CVarCurlDebugServerResponseEnabled include using GetValueOnAnyThread() to safely access its value from any thread, as demonstrated in the provided code snippet.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/Curl/CurlHttp.cpp:20

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarCurlDebugServerResponseEnabled(
	TEXT("http.CurlDebugServerResponseEnabled"),
	false,
	TEXT("Enable debugging of server response")
);

#if WITH_SSL
static int SslCertVerify(int PreverifyOk, X509_STORE_CTX* Context)

#Associated Variable and Callsites

This variable is associated with another variable named CVarCurlDebugServerResponseEnabled. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/Curl/CurlHttp.cpp:19

Scope: file

Source code excerpt:

#endif

TAutoConsoleVariable<bool> CVarCurlDebugServerResponseEnabled(
	TEXT("http.CurlDebugServerResponseEnabled"),
	false,
	TEXT("Enable debugging of server response")
);

#if WITH_SSL

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/Curl/CurlHttp.cpp:1220

Scope (from outer to inner):

file
function     void FCurlHttpRequest::FinishRequest

Source code excerpt:

	if (Response.IsValid() && Response->bSucceeded)
	{
		bool bDebugServerResponse = CVarCurlDebugServerResponseEnabled.GetValueOnAnyThread() && (Response->GetResponseCode() >= 500 && Response->GetResponseCode() <= 503);

		// log info about error responses to identify failed downloads
		if (UE_LOG_ACTIVE(LogHttp, Verbose) || bDebugServerResponse)
		{
			if (bDebugServerResponse)
			{