Ejemplo n.º 1
0
        protected void SetAllowInvalidSSLCertificates(HTTPClient client)
        {
            uint connectionID = client.ConnectionID;

            Bindings._URLClientSetAllowInvalidSSLCertificate(
                connectionID, allowInvalidSSLCertificates);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public virtual HTTPResponse OnDidUpdate(HTTPClient client,
                                                HTTPResponse response)
        {
            if (client.State < ConnectionState.ReceivingData)
            {
                return(response);
            }

            if (response == null)
            {
                response = CreateResponse(client);
            }

            while (true)
            {
                UpdateContentData(client, response);

                if (CheckNeedsResponseReset(client) == false)
                {
                    break;
                }

                response = ResetResponse(client, response);
            }

            return(response);
        }
 protected override HTTPResponse ResetResponse(HTTPClient client,
     HTTPResponse response)
 {
   response = base.ResetResponse(client, response);
   CreateStream(response);
   return response;
 }
Ejemplo n.º 5
0
        protected override HTTPResponse CreateResponse(HTTPClient client)
        {
            HTTPResponse response = base.CreateResponse(client);

            response.supportsContentMemoryStream = true;
            return(response);
        }
 protected override HTTPResponse CreateResponse(HTTPClient client)
 {
   HTTPResponse response = base.CreateResponse(client);
   response.supportsContentFilePath = true;
   response.contentFilePath = _destinationPath;
   return response;
 }
    public override void OnWillSendRequest(HTTPClient client)
    {
      base.OnWillSendRequest(client);

      uint connectionID = client.ConnectionID;
      Bindings._URLClientSetRequestContentSource(connectionID, _sourcePath);
    }
Ejemplo n.º 8
0
        protected void SetAllowFollowRedirects(HTTPClient client)
        {
            uint connectionID = client.ConnectionID;

            Bindings._URLClientSetAllowFollowRedirects(
                connectionID, allowFollowRedirects, maxRedirectCount);
        }
Ejemplo n.º 9
0
 protected override HTTPResponse ResetResponse(HTTPClient client,
                                               HTTPResponse response)
 {
     response = base.ResetResponse(client, response);
     CreateStream(response);
     return(response);
 }
        public override void OnWillSendRequest(HTTPClient client)
        {
            base.OnWillSendRequest(client);

            uint connectionID = client.ConnectionID;

            Bindings._URLClientSetRequestContentSource(connectionID, _sourcePath);
        }
Ejemplo n.º 11
0
        protected override void UpdateContentData(HTTPClient client,
                                                  HTTPResponse response)
        {
            uint connectionID = client.ConnectionID;

            response.receivedContentLength =
                Bindings._URLClientGetResponseContentLengthRead(connectionID);
        }
Ejemplo n.º 12
0
        protected virtual bool CheckNeedsResponseReset(HTTPClient client)
        {
            uint connectionID = client.ConnectionID;
            bool isDirty      =
                Bindings._URLClientCheckAndResetResponseDirtyFlag(connectionID);

            return(isDirty);
        }
Ejemplo n.º 13
0
        protected override HTTPResponse CreateResponse(HTTPClient client)
        {
            HTTPResponse response = base.CreateResponse(client);

            response.supportsContentFilePath = true;
            response.contentFilePath         = _destinationPath;
            return(response);
        }
    public override void OnWillSendRequest(HTTPClient client)
    {
      base.OnWillSendRequest(client);

      uint connectionID = client.ConnectionID;
      Bindings.URLClientSetRequestContent(connectionID, _bytes,
          (ulong)_bytes.Length);
    }
        public override void OnWillSendRequest(HTTPClient client)
        {
            base.OnWillSendRequest(client);

            uint connectionID = client.ConnectionID;

            Bindings.URLClientSetRequestContent(connectionID, _bytes,
                                                (ulong)_bytes.Length);
        }
Ejemplo n.º 16
0
        protected void SetAcceptableStatusCodes(HTTPClient client)
        {
            uint connectionID = client.ConnectionID;

            if (acceptableStatusCodeRanges != null)
            {
                foreach (HTTPStatusCodeRange range in acceptableStatusCodeRanges)
                {
                    Bindings._URLClientAddAcceptableResponseStatusCodeRange(
                        connectionID, range.fromCode, range.toCode);
                }
            }
        }
    public override void OnWillSendRequest(HTTPClient client)
    {
      if (_allowResume == true)
      {
        AddAcceptableStatusCode(200);
        AddAcceptableStatusCode(206);
        AddAcceptableStatusCode(416);
      }

      base.OnWillSendRequest(client);

      uint connectionID = client.ConnectionID;
      Bindings._URLClientSetResponseContentDestination(connectionID,
          _destinationPath, _allowResume);
    }
Ejemplo n.º 18
0
        public override void OnWillSendRequest(HTTPClient client)
        {
            if (_allowResume == true)
            {
                AddAcceptableStatusCode(200);
                AddAcceptableStatusCode(206);
                AddAcceptableStatusCode(416);
            }

            base.OnWillSendRequest(client);

            uint connectionID = client.ConnectionID;

            Bindings._URLClientSetResponseContentDestination(connectionID,
                                                             _destinationPath, _allowResume);
        }
Ejemplo n.º 19
0
        protected virtual HTTPResponse CreateResponse(HTTPClient client)
        {
            uint connectionID = client.ConnectionID;

            HTTPResponse response = new HTTPResponse();

            response.statusCode =
                Bindings._URLClientGetResponseStatusCode(connectionID);

            response.resumedContentLength =
                Bindings._URLClientGetResponseContentLengthResumed(connectionID);
            response.expectedReceiveContentLength =
                Bindings._URLClientGetResponseContentExpectedLength(connectionID);
            response.redirectCount =
                Bindings._URLClientGetResponseRedirectCount(connectionID);

            response.headers = CreateHeaders(client);

            return(response);
        }
Ejemplo n.º 20
0
 public virtual bool OnWillStart(HTTPClient client)
 {
     return(true);
 }
 public override bool OnWillStart(HTTPClient client)
 {
   return (string.IsNullOrEmpty(_destinationPath) == false);
 }
 public virtual void OnWillSendRequest(HTTPClient client)
 {
 }
 public virtual bool OnWillStart(HTTPClient client)
 {
   return true;
 }
 protected abstract void UpdateContentData(HTTPClient client,
     HTTPResponse response);
 protected override HTTPResponse CreateResponse(HTTPClient client)
 {
   HTTPResponse response = base.CreateResponse(client);
   response.supportsContentStream = true;
   return response;
 }
Ejemplo n.º 26
0
 public override bool OnWillStart(HTTPClient client)
 {
     return(string.IsNullOrEmpty(_destinationPath) == false);
 }
    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;
    }
Ejemplo n.º 28
0
 public virtual void OnWillSendRequest(HTTPClient client)
 {
     SetAllowFollowRedirects(client);
     SetAcceptableStatusCodes(client);
     SetAllowInvalidSSLCertificates(client);
 }
    protected void SetAllowInvalidSSLCertificates(HTTPClient client)
    {
      uint connectionID = client.ConnectionID;

      Bindings._URLClientSetAllowInvalidSSLCertificate(
          connectionID, allowInvalidSSLCertificates);
    }
    protected void SetAcceptableStatusCodes(HTTPClient client)
    {
      uint connectionID = client.ConnectionID;

      if (acceptableStatusCodeRanges != null)
      {
        foreach (HTTPStatusCodeRange range in acceptableStatusCodeRanges)
        {
          Bindings._URLClientAddAcceptableResponseStatusCodeRange(
              connectionID, range.fromCode, range.toCode);
        }
      }
    }
Ejemplo n.º 31
0
 protected virtual HTTPResponse ResetResponse(HTTPClient client,
                                              HTTPResponse response)
 {
     response = CreateResponse(client);
     return(response);
 }
 public override bool OnWillStart(HTTPClient client)
 {
     return(_bytes != null);
 }
 public virtual void OnWillSendRequest(HTTPClient client)
 {
 }
    protected virtual bool CheckNeedsResponseReset(HTTPClient client)
    {
      uint connectionID = client.ConnectionID;
      bool isDirty =
        Bindings._URLClientCheckAndResetResponseDirtyFlag(connectionID);

      return isDirty;
    }
 protected override void UpdateContentData(HTTPClient client,
     HTTPResponse response)
 {
   uint connectionID = client.ConnectionID;
   response.receivedContentLength =
     Bindings._URLClientGetResponseContentLengthRead(connectionID);
 }
 protected virtual HTTPResponse ResetResponse(HTTPClient client,
     HTTPResponse response)
 {
   response = CreateResponse(client);
   return response;
 }
    public virtual HTTPResponse OnDidUpdate(HTTPClient client,
        HTTPResponse response)
    {
      if (client.State < ConnectionState.ReceivingData)
      {
        return response;
      }

      if (response == null)
      {
        response = CreateResponse(client);
      }

      while (true)
      {
        UpdateContentData(client, response);

        if (CheckNeedsResponseReset(client) == false)
        {
          break;
        }

        response = ResetResponse(client, response);
      }

      return response;
    }
Ejemplo n.º 38
0
 protected abstract void UpdateContentData(HTTPClient client,
                                           HTTPResponse response);
 public virtual void OnWillSendRequest(HTTPClient client)
 {
   SetAllowFollowRedirects(client);
   SetAcceptableStatusCodes(client);
   SetAllowInvalidSSLCertificates(client);
 }
    protected virtual HTTPResponse CreateResponse(HTTPClient client)
    {
      uint connectionID = client.ConnectionID;

      HTTPResponse response = new HTTPResponse();

      response.statusCode =
        Bindings._URLClientGetResponseStatusCode(connectionID);

      response.resumedContentLength =
        Bindings._URLClientGetResponseContentLengthResumed(connectionID);
      response.expectedReceiveContentLength =
        Bindings._URLClientGetResponseContentExpectedLength(connectionID);
      response.redirectCount =
        Bindings._URLClientGetResponseRedirectCount(connectionID);

      response.headers = CreateHeaders(client);

      return response;
    }
    protected void SetAllowFollowRedirects(HTTPClient client)
    {
      uint connectionID = client.ConnectionID;

      Bindings._URLClientSetAllowFollowRedirects(
          connectionID, allowFollowRedirects, maxRedirectCount);
    }
 public override bool OnWillStart(HTTPClient client)
 {
   return (_bytes != null);
 }