public void AddAuthentication(AuthenticationBase AAuthentication, URI AUrl)
 {
   AuthenticationItem TempItem = new AuthenticationItem();
   for (int i = 0; i < AAuthentication.Params.Count; i++) {
     TempItem.Params.Add(AAuthentication.Params.Names(i), AAuthentication.Params.ValueFromIndex(i));
   }
   TempItem.Url = new URI(AUrl.URIString);
   _Authentications.Add(TempItem);
 }
        public void AddAuthentication(AuthenticationBase AAuthentication, URI AUrl)
        {
            AuthenticationItem TempItem = new AuthenticationItem();

            for (int i = 0; i < AAuthentication.Params.Count; i++)
            {
                TempItem.Params.Add(AAuthentication.Params.Names(i), AAuthentication.Params.ValueFromIndex(i));
            }
            TempItem.Url = new URI(AUrl.URIString);
            _Authentications.Add(TempItem);
        }
		public void SetHeaders(HeaderList AHeaders) {
			string S = "";
			if (_Authentication != null) {
				S = _Authentication.Authentication();
				if (S.Length > 0) {
					AHeaders.Values("Proxy-Authentication", S);
				}
			} else {
				if (_BasicByDefault) {
					_Authentication = new BasicAuthentication();
					_Authentication.UserName = _UserName;
					_Authentication.Password = _Password;
					S = _Authentication.Authentication();
					if (S.Length > 0) {
						AHeaders.Values("Proxy-Authentication", S);
					}
				}
			}
		}
	  protected override void DoSetHeaders()
	  {
	    base.DoSetHeaders();
	    
	    if (_ProxyConnection.Length > 0)
	    {
	      _RawHeaders.Values("Proxy-Connection", _ProxyConnection);
	    }
	    if (_Host.Length > 0)
	    {
	      _RawHeaders.Values("Host", _Host);
	    }
      if (_Accept.Length > 0)
      {
        _RawHeaders.Values("Accept", _Accept);
      }
      if (_AcceptCharSet.Length > 0)
      {
        _RawHeaders.Values("Accept-Charset", _AcceptCharSet);
      }
      if (_AcceptEncoding.Length > 0)
      {
        _RawHeaders.Values("Accept-Language", _AcceptLanguage);
      }
      if (_From.Length > 0)
      {
        _RawHeaders.Values("From", _From);
      }
      if (_Referer.Length > 0)
      {
        _RawHeaders.Values("Referer", _Referer);
      }
      if (_UserAgent.Length > 0)
      {
        _RawHeaders.Values("User-Agent", _UserAgent);
      }
      if (_LastModified.Ticks > 0)
      {
				_RawHeaders.Values("If-Modified-Since", Http.DateTimeGmtToHttpStr(_LastModified));
      }
      if (_ContentRangeStart != 0
        ||_ContentRangeEnd != 0)
      {
        if (_ContentRangeEnd != 0)
        {
          _RawHeaders.Values("Range", "bytes=" + _ContentRangeStart.ToString() + "-" + _ContentRangeEnd.ToString());
        }
        else
        {
          _RawHeaders.Values("Range", "bytes=" + _ContentRangeStart.ToString() + "-");
        }
      }
      if (_Authentication != null)
      {
        string S = _Authentication.Authentication();
        if (S.Length > 0)
        {
          _RawHeaders.Values("Authorization", S);
        }
      }
      else
      {
        if (_BasicByDefault)
        {
          _Authentication = new BasicAuthentication();
          _Authentication.UserName = _UserName;
          _Authentication.Password = _Password;
          string S = _Authentication.Authentication();
          if (S.Length > 0)
          {
            _RawHeaders.Values("Authorization", S);
          }
        }
      }
	  }