HTTPProxy.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #if !BESTHTTP_DISABLE_PROXY
  2. using System;
  3. using BestHTTP.Authentication;
  4. namespace BestHTTP
  5. {
  6. public sealed class HTTPProxy
  7. {
  8. /// <summary>
  9. /// Address of the proxy server. It has to be in the http://proxyaddress:port form.
  10. /// </summary>
  11. public Uri Address { get; set; }
  12. /// <summary>
  13. /// Credentials of the proxy
  14. /// </summary>
  15. public Credentials Credentials { get; set; }
  16. /// <summary>
  17. /// True if the proxy can act as a transparent proxy
  18. /// </summary>
  19. public bool IsTransparent { get; set; }
  20. /// <summary>
  21. /// Some non-transparent proxies are except only the path and query of the request uri. Default value is true
  22. /// </summary>
  23. public bool SendWholeUri { get; set; }
  24. /// <summary>
  25. /// Regardless of the value of IsTransparent, for secure protocols(HTTPS://, WSS://) the plugin will use the proxy as an explicit proxy(will issue a CONNECT request to the proxy)
  26. /// </summary>
  27. public bool NonTransparentForHTTPS { get; set; }
  28. public HTTPProxy(Uri address)
  29. :this(address, null, false)
  30. {}
  31. public HTTPProxy(Uri address, Credentials credentials)
  32. :this(address, credentials, false)
  33. {}
  34. public HTTPProxy(Uri address, Credentials credentials, bool isTransparent)
  35. :this(address, credentials, isTransparent, true)
  36. { }
  37. public HTTPProxy(Uri address, Credentials credentials, bool isTransparent, bool sendWholeUri)
  38. : this(address, credentials, isTransparent, true, true)
  39. { }
  40. public HTTPProxy(Uri address, Credentials credentials, bool isTransparent, bool sendWholeUri, bool nonTransparentForHTTPS)
  41. {
  42. this.Address = address;
  43. this.Credentials = credentials;
  44. this.IsTransparent = isTransparent;
  45. this.SendWholeUri = sendWholeUri;
  46. this.NonTransparentForHTTPS = nonTransparentForHTTPS;
  47. }
  48. }
  49. }
  50. #endif