Class UnityWebRequestService.WebRequestConfig
Configuration object for web requests.
public class UnityWebRequestService.WebRequestConfig
- Inheritance
-
UnityWebRequestService.WebRequestConfig
- Inherited Members
Fields
CertificateHandlerFactory
Optional factory for creating a certificate handler per attempt. A new instance is needed for each retry because the handler is disposed together with the UnityWebRequest.
public Func<CertificateHandler> CertificateHandlerFactory
Field Value
- Func<CertificateHandler>
DownloadHandlerFactory
Optional factory for creating a download handler per attempt. A new instance is needed for each retry because DownloadHandlerFile (and other handlers) are disposed together with the UnityWebRequest.
public Func<DownloadHandler> DownloadHandlerFactory
Field Value
- Func<DownloadHandler>
Headers
Optional request headers.
public Dictionary<string, string> Headers
Field Value
IdleTimeout
Seconds a transfer may make no progress before it is abandoned. Zero disables it.
public int IdleTimeout
Field Value
Remarks
B1. The patch download shared the 10-second whole-request timeout with the version check, because both went through this method and there was only one knob. A whole-request deadline applied to a download does not mean "give up when the server stops answering" — it means "give up when the file takes longer than ten seconds", so any patch too large for the player's link was permanently undownloadable no matter how well the transfer was going. Raising the timeout is not the fix either: it is a guess at how long a legitimate download may take, and any guess is simultaneously too short for someone on a slow connection and too long as a hang detector.
An idle timeout asks the question that actually matters. A transfer moving at 40 KiB/s is healthy however long it takes; a transfer that has moved nothing for thirty seconds is stuck at any size. So a download sets Timeout to zero and this instead, and it is bounded by progress rather than by duration.
MaxResponseBytes
Maximum bytes accepted for this response. Zero means unbounded.
public long MaxResponseBytes
Field Value
Remarks
H1/H6. Without a cap, the size of the response is whatever the server says
it is — which for the news feed is an out-of-memory crash on the main thread, and
for a patch download is the player's disk filled by a host that decided to keep
sending. Enforced by polling downloadedBytes and aborting, so it applies
to a chunked response with no Content-Length as well as an honest one.
MaxRetries
Maximum retry attempts after the initial request fails.
public int MaxRetries
Field Value
Method
HTTP method (for example GET, POST).
public string Method
Field Value
OnComplete
Completion callback when request succeeds.
public Action<UnityWebRequest> OnComplete
Field Value
- Action<UnityWebRequest>
OnFailure
Failure callback when all retries are exhausted.
public Action<UnityWebRequest> OnFailure
Field Value
- Action<UnityWebRequest>
OnProgress
Optional progress callback.
public Action<UnityWebRequest, float> OnProgress
Field Value
RetryDelay
Delay in seconds between retries.
public float RetryDelay
Field Value
Timeout
Per-request timeout in seconds. Zero disables the whole-request deadline.
public int Timeout
Field Value
Remarks
UnityWebRequest.timeout bounds the entire request, not the gaps
within it. That is right for a small JSON response and wrong for a file transfer:
see IdleTimeout.
URL
Request URL.
public string URL