With the following properties we can change some defaults that otherwise should be specified in the HTTPRequest's constructor. So most of these properties are time saving shortcuts, however, because higher level protocols use the
HTTPRequest class too, these settings affect all protocols too.
These changes will affect all request that created after their values changed.
Changing the defaults can be made through the static properties of the
HTTPManager class. Current settings are the following:
HTTPManager.MaxConnectionPerServer = 10;
HTTP/2 uses one TCP connection, it has different setting for stream concurrency.
The default value of the HTTPRequest's
IsKeepAlive property. If
false, the tcp connections to the server will be set up before every request and closed right after it. It should be changed to false if consecutive requests are rare. Values given to the HTTPRequest's constructor will override this value for this request. Its default value is
HTTPManager.KeepAliveDefaultValue = false;
With this property we can globally disable or enable the caching service. Values given to the HTTPRequest's constructor will override this value for this request. Its default value is false.
HTTPManager.IsCachingDisabled = true;
Specifies the idle time BestHTTP should wait before it destroys the connection after it's finished the last request. Its default value is 20 seconds.
HTTPManager.MaxConnectionIdleTime = TimeSpan.FromSeconds(60);
With this option all
Cookie operation can be enabled or disabled. Its default value is true.
HTTPManager.IsCookiesEnabled = false;
With this option the size of the
Cookie store can be controlled. Its default value is 10485760 (10 MB).
HTTPManager.CookieJarSize = 1048576;
If this option is enabled no
Cookie will be written to the disk. Its default value is false.
HTTPManager.EnablePrivateBrowsing = true;
With this option you can set the HTTPRequests' default
ConnectTimeout value. Its default value is 20 seconds.
HTTPManager.ConnectTimeout = TimeSpan.FromSeconds(60);
With this option you can set the HTTPRequests' default Timeout value. Its default value is 60 seconds.
HTTPManager.RequestTimeout = TimeSpan.FromSeconds(60);
By default the plugin will save all cache and cookie data under the path returned by
Application.persistentDataPath. You can assign a function to this delegate to return a custom root path to define a new path. This delegate will be called on a non Unity thread!
HTTPManager.RootCacheFolderProvider = () => Application.temporaryCachePath;
The global, default proxy for all HTTPRequests. The HTTPRequest's Proxy still can be changed per-request. Default value is
null. More information can be found about proxies in the Proxy topic.
HTTPManager.Proxy = new HTTPProxy(new Uri("http://localhost:8888"), null, true);
An ILogger implementation to be able to control what information will be logged about the plugin's internals, and how these will be logged.
HTTPManager.Logger = new ThreadedLogger();
ICertificateVerifyer implementation can be set to this property. All new requests created after this will use this verifier when a secure protocol is used and the request's
ICertificateVerifyer implementation can be used to implement server certificate validation.
HTTPManager.DefaultCertificateVerifyer = new AlwaysValidVerifyer();
The default value of HTTPRequest's UseAlternateSSL can be changed through this property. Its default value is
HTTPManager.UseAlternateSSLDefaultValue = false;
Through this property, HTTP/2 related settings can be changed. See the HTTP/2 topic for more information.
HTTPManager.HTTP2Settings.MaxConcurrentStreams = 256;
It's true if the application is quitting and the plugin is shutting down itself.
User-agent string that will be sent with each requests. It's default value contains the version of the plugin (
"BestHTTP/2 v2.2.1" for example).
HTTPManager.UserAgent = string.Empty;