Пример #1
0
        bool _Update()
        {
            string url = HttpDns.GetUrl(cRequest.url);  // get dsn ip

            if (string.IsNullOrEmpty(url))
            {
                return(true); //wait for ip
            }

            if (url != cRequest.url)
            {
                var headers = cRequest.head;
                if (headers == null)
                {
                    headers       = new WebHeaderCollection();
                    cRequest.head = headers;
                }

                if (string.IsNullOrEmpty(headers.Get("host")))
                {
                    headers.Add("host", new System.Uri(cRequest.url).Host);
                }
                // Debug.LogFormat("request ip {0}  override host {1} ",url,cRequest.overrideHost);
                ResourcesLoader.UnityWebRequest(cRequest);
            }
            else if (originalOperation != null)
            {
                Debug.LogFormat(" dns resolve fail request url {0}   ", url);
                ResourcesLoader.ProcessFinishedOperation(originalOperation);
            }
            else
            {
                Debug.LogFormat("dns resolve fail , complete request url {0} ", url);

                cRequest.DispatchEnd();

                if (cRequest.group != null)
                {
                    cRequest.group.Complete(cRequest, true);
                }

                cRequest.ReleaseToPool();
            }

            return(false);
        }
Пример #2
0
        public static bool CheckResolveHost(CRequest req)
        {
            string error = req.error.ToLower();

            if (!req.url.StartsWith("https") &&
                ((error.Contains("resolve") && error.Contains("host")) ||
                 error.Contains("nameresolutionfailure"))) //dns error
            {
                string url = HttpDns.GetUrl(req.url);      //请求dns
                if (url != req.url)
                {
                    // if (req.headers == null)
                    //     req.headers = new Dictionary<string, string> ();
                    req.overrideHost = req.uri.Host;// set host
                    req.overrideUrl  = url;
                }
                return(true);
            }
            return(false);
        }
Пример #3
0
        bool _Update()
        {
            string url = HttpDns.GetUrl(cRequest.url); // get dsn ip

            if (string.IsNullOrEmpty(url))
            {
                return(true); //wait for ip
            }

            if (url != cRequest.url)
            {
                cRequest.overrideHost = cRequest.uri.Host;// set host
                cRequest.overrideUrl  = url;
                // request
                Debug.LogFormat("request ip {0}  override host {1} ", url, cRequest.overrideHost);
                ResourcesLoader.HttpRequest(cRequest);
            }
            else if (originalOperation != null)
            {
                Debug.LogFormat(" dns resolve fail request url {0}   ", url);
                ResourcesLoader.ProcessFinishedOperation(originalOperation);
            }
            else
            {
                Debug.LogFormat("dns resolve fail , complete request url {0} ", url);

                cRequest.DispatchEnd();

                if (cRequest.group != null)
                {
                    cRequest.group.Complete(cRequest, true);
                }

                cRequest.ReleaseToPool();
            }

            return(false);
        }
Пример #4
0
        bool _IsDone()
        {
            string url = HttpDns.GetUrl(cRequest.url);

            return(!string.IsNullOrEmpty(url));
        }