예제 #1
0
        protected HTTPHeaderList CreateHeaders(HTTPClient client)
        {
            uint           connectionID = client.ConnectionID;
            HTTPHeaderList headers = new HTTPHeaderList();
            string         name, value;

            // read headers
            for (uint i = 0; i < (uint)int.MaxValue; ++i)
            {
                name = Bindings._URLClientGetResponseHeaderName(connectionID, i);
                if (name == null)
                {
                    break;
                }
                value = Bindings._URLClientGetResponseHeaderValue(connectionID, i);
                if (value == null)
                {
                    break;
                }

                headers[name] = value;
            }

            return(headers);
        }
 public HTTPClient(string url, string destinationPath,
                   bool allowResume = true, HTTPHeaderList headers = null) :
     this(new HTTPRequest(url, headers))
 {
     _responseHandler = new HTTPResponseDownloadHandler(destinationPath,
                                                        allowResume);
 }
예제 #3
0
 public HTTPRequest SetHeader(string name, string value)
 {
     if (headers == null)
     {
         headers = new HTTPHeaderList();
     }
     headers[name] = value;
     return(this);
 }
        protected void SetRequestHeaders()
        {
            HTTPHeaderList headers = _request.headers;

            if (headers != null)
            {
                foreach (KeyValuePair <string, string> header in headers)
                {
                    Bindings._URLClientSetRequestHeader(_connectionID,
                                                        header.Key, header.Value);
                }
            }
        }
예제 #5
0
        public HTTPRequest(string url, HTTPHeaderList headers = null)
        {
            method = "GET";
            SetURL(url);

            if (headers == null)
            {
                headers = new HTTPHeaderList();
            }

            authUser       = null;
            authPassword   = null;
            contentHandler = null;
        }
        public HTTPResponse()
        {
            statusCode                   = (long)0;
            receivedContentLength        = (ulong)0;
            resumedContentLength         = (ulong)0;
            expectedReceiveContentLength = (long)-1;

            supportsContentStream       = false;
            contentStream               = null;
            supportsContentMemoryStream = false;
            supportsContentFilePath     = false;
            contentFilePath             = null;

            headers = null;
        }
 public HTTPClient(string url, HTTPHeaderList headers = null) :
     this(new HTTPRequest(url, headers))
 {
 }