public override bool AddOption(CURLOPTIONTYPE type, string cname, string value)
    {
      // Correct spelling of some names
      if (cname.Equals("AcceptEncoding", StringComparison.OrdinalIgnoreCase))
        cname = "Accept-Encoding";

      // Ignore some non-http headers
      if (cname.Equals("seekable", StringComparison.OrdinalIgnoreCase))
        return true;

      switch (type)
      {
        case CURLOPTIONTYPE.CURL_OPTION_CREDENTIALS:
          _handler.Credentials = new NetworkCredential(cname, value);
          break;
        case CURLOPTIONTYPE.CURL_OPTION_PROTOCOL:
        case CURLOPTIONTYPE.CURL_OPTION_HEADER:
          if (cname.Equals("postdata", StringComparison.OrdinalIgnoreCase))
            _postData = Convert.FromBase64String(value);
          else
            _headers.Add(cname, value);
          break;
        case CURLOPTIONTYPE.CURL_OPTION_OPTION:
          break;
        default:
          return false;
      }
      return true;
    }
Ejemplo n.º 2
0
 public abstract bool AddOption(CURLOPTIONTYPE type, string name, string value);