コード例 #1
0
        private CHttpWebRequestResponse GetWebRequestResponse()
        {
            var webRequest      = new HttpWebRequest(new Uri(uri));
            var requestResponse = new CHttpWebRequestResponse(webRequest);

            webRequest.Method = method.ToString();

            webRequest.KeepAlive = false;

            if (cookieContainer != null)
            {
                webRequest.CookieContainer = cookieContainer;
            }

            if (headers != null)
            {
                headers.Walk(webRequest.Headers.Add);
            }

            if (requestBytes != null)
            {
                if (method != ERestful.DELETE)
                {
                    webRequest.ContentType   = contentType;
                    webRequest.ContentLength = requestBytes.Length;
                    requestResponse.SetRequestBytes(requestBytes);
                }
            }

            if (timeout > 0)
            {
                webRequest.Timeout = timeout;
            }

            if (readWriteTimeout > 0)
            {
                webRequest.ReadWriteTimeout = readWriteTimeout;
            }

            requestResponse.Send();
            return(requestResponse);
        }
コード例 #2
0
 public IEnumerator Send()
 {
     return(response = GetWebRequestResponse());
 }