Пример #1
0
    public HTTPRequest(string url, HTTPHeaderList headers = null)
    {
      method = "GET";
      SetURL(url);

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

      authUser = null;
      authPassword = null;
      contentHandler = null;
    }
Пример #2
0
 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 HTTPClient(string url, HTTPHeaderList headers = null) :
   this(new HTTPRequest(url, headers))
 {
 }
    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;
    }
Пример #5
0
    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;
    }
Пример #6
0
 public HTTPRequest SetHeader(string name, string value)
 {
   if (headers == null)
   {
     headers = new HTTPHeaderList();
   }
   headers[name] = value;
   return this;
 }