private void InternalSetUrl(string url) { if (!isModifiable) { throw new InvalidOperationException("UnityWebRequest has already been sent and its URL cannot be altered"); } UnityWebRequestError ret = SetUrl(url); if (ret != UnityWebRequestError.OK) { throw new InvalidOperationException(UnityWebRequest.GetWebErrorString(ret)); } }
internal void InternalSetCustomMethod(string customMethodName) { if (!isModifiable) { throw new InvalidOperationException("UnityWebRequest has already been sent and its request method can no longer be altered"); } UnityWebRequestError ret = SetCustomMethod(customMethodName); if (ret != UnityWebRequestError.OK) { throw new InvalidOperationException(UnityWebRequest.GetWebErrorString(ret)); } }
public void SetRequestHeader(string name, string value) { if (String.IsNullOrEmpty(name)) { throw new ArgumentException("Cannot set a Request Header with a null or empty name"); } // Only check for null here, as in general header value can be empty, i.e. Accept-Encoding can have empty value according spec. if (value == null) { throw new ArgumentException("Cannot set a Request header with a null"); } if (!isModifiable) { throw new InvalidOperationException("UnityWebRequest has already been sent and its request headers cannot be altered"); } UnityWebRequestError ret = InternalSetRequestHeader(name, value); if (ret != UnityWebRequestError.OK) { throw new InvalidOperationException(UnityWebRequest.GetWebErrorString(ret)); } }
private static string GetErrorDescription(UnityWebRequestError errorCode) { string result; switch (errorCode) { case UnityWebRequestError.OK: result = "No Error"; return(result); case UnityWebRequestError.SDKError: result = "Internal Error With Transport Layer"; return(result); case UnityWebRequestError.UnsupportedProtocol: result = "Specified Transport Protocol is Unsupported"; return(result); case UnityWebRequestError.MalformattedUrl: result = "URL is Malformatted"; return(result); case UnityWebRequestError.CannotResolveProxy: result = "Unable to resolve specified proxy server"; return(result); case UnityWebRequestError.CannotResolveHost: result = "Unable to resolve host specified in URL"; return(result); case UnityWebRequestError.CannotConnectToHost: result = "Unable to connect to host specified in URL"; return(result); case UnityWebRequestError.AccessDenied: result = "Remote server denied access to the specified URL"; return(result); case UnityWebRequestError.GenericHttpError: result = "Unknown/Generic HTTP Error - Check HTTP Error code"; return(result); case UnityWebRequestError.WriteError: result = "Error when transmitting request to remote server - transmission terminated prematurely"; return(result); case UnityWebRequestError.ReadError: result = "Error when reading response from remote server - transmission terminated prematurely"; return(result); case UnityWebRequestError.OutOfMemory: result = "Out of Memory"; return(result); case UnityWebRequestError.Timeout: result = "Timeout occurred while waiting for response from remote server"; return(result); case UnityWebRequestError.HTTPPostError: result = "Error while transmitting HTTP POST body data"; return(result); case UnityWebRequestError.SSLCannotConnect: result = "Unable to connect to SSL server at remote host"; return(result); case UnityWebRequestError.Aborted: result = "Request was manually aborted by local code"; return(result); case UnityWebRequestError.TooManyRedirects: result = "Redirect limit exceeded"; return(result); case UnityWebRequestError.ReceivedNoData: result = "Received an empty response from remote host"; return(result); case UnityWebRequestError.SSLNotSupported: result = "SSL connections are not supported on the local machine"; return(result); case UnityWebRequestError.FailedToSendData: result = "Failed to transmit body data"; return(result); case UnityWebRequestError.FailedToReceiveData: result = "Failed to receive response body data"; return(result); case UnityWebRequestError.SSLCertificateError: result = "Failure to authenticate SSL certificate of remote host"; return(result); case UnityWebRequestError.SSLCipherNotAvailable: result = "SSL cipher received from remote host is not supported on the local machine"; return(result); case UnityWebRequestError.SSLCACertError: result = "Failure to authenticate Certificate Authority of the SSL certificate received from the remote host"; return(result); case UnityWebRequestError.UnrecognizedContentEncoding: result = "Remote host returned data with an unrecognized/unparseable content encoding"; return(result); case UnityWebRequestError.LoginFailed: result = "HTTP authentication failed"; return(result); case UnityWebRequestError.SSLShutdownFailed: result = "Failure while shutting down SSL connection"; return(result); } result = "Unknown error"; return(result); }
private extern static string GetWebErrorString(UnityWebRequestError err);
private static string GetErrorDescription(UnityWebRequestError errorCode) { switch (errorCode) { case UnityWebRequestError.OK: return "No Error"; case UnityWebRequestError.SDKError: return "Internal Error With Transport Layer"; case UnityWebRequestError.UnsupportedProtocol: return "Specified Transport Protocol is Unsupported"; case UnityWebRequestError.MalformattedUrl: return "URL is Malformatted"; case UnityWebRequestError.CannotResolveProxy: return "Unable to resolve specified proxy server"; case UnityWebRequestError.CannotResolveHost: return "Unable to resolve host specified in URL"; case UnityWebRequestError.CannotConnectToHost: return "Unable to connect to host specified in URL"; case UnityWebRequestError.AccessDenied: return "Remote server denied access to the specified URL"; case UnityWebRequestError.GenericHTTPError: return "Unknown/Generic HTTP Error - Check HTTP Error code"; case UnityWebRequestError.WriteError: return "Error when transmitting request to remote server - transmission terminated prematurely"; case UnityWebRequestError.ReadError: return "Error when reading response from remote server - transmission terminated prematurely"; case UnityWebRequestError.OutOfMemory: return "Out of Memory"; case UnityWebRequestError.Timeout: return "Timeout occurred while waiting for response from remote server"; case UnityWebRequestError.HTTPPostError: return "Error while transmitting HTTP POST body data"; case UnityWebRequestError.SSLCannotConnect: return "Unable to connect to SSL server at remote host"; case UnityWebRequestError.Aborted: return "Request was manually aborted by local code"; case UnityWebRequestError.TooManyRedirects: return "Redirect limit exceeded"; case UnityWebRequestError.ReceivedNoData: return "Received an empty response from remote host"; case UnityWebRequestError.SSLNotSupported: return "SSL connections are not supported on the local machine"; case UnityWebRequestError.FailedToSendData: return "Failed to transmit body data"; case UnityWebRequestError.FailedToReceiveData: return "Failed to receive response body data"; case UnityWebRequestError.SSLCertificateError: return "Failure to authenticate SSL certificate of remote host"; case UnityWebRequestError.SSLCipherNotAvailable: return "SSL cipher received from remote host is not supported on the local machine"; case UnityWebRequestError.SSLCACertError: return "Failure to authenticate Certificate Authority of the SSL certificate received from the remote host"; case UnityWebRequestError.UnrecognizedContentEncoding: return "Remote host returned data with an unrecognized/unparseable content encoding"; case UnityWebRequestError.LoginFailed: return "HTTP authentication failed"; case UnityWebRequestError.SSLShutdownFailed: return "Failure while shutting down SSL connection"; } return "Unknown error"; }