Added checking more for the proxy authentication
This commit is contained in:
parent
778d01b3d7
commit
4042922810
@ -1333,9 +1333,19 @@ namespace WebSocketSharp
|
|||||||
var req = HttpRequest.CreateConnectRequest (_uri);
|
var req = HttpRequest.CreateConnectRequest (_uri);
|
||||||
var res = sendHttpRequest (req, 90000);
|
var res = sendHttpRequest (req, 90000);
|
||||||
if (res.IsProxyAuthenticationRequired) {
|
if (res.IsProxyAuthenticationRequired) {
|
||||||
var authChal = res.ProxyAuthenticationChallenge;
|
var chal = res.Headers["Proxy-Authenticate"];
|
||||||
if (authChal != null && _proxyCredentials != null) {
|
_logger.Warn (
|
||||||
if (res.Headers.Contains ("Connection", "close")) {
|
String.Format ("Received a proxy authentication requirement for '{0}'.", chal));
|
||||||
|
|
||||||
|
if (chal.IsNullOrEmpty ())
|
||||||
|
throw new WebSocketException ("No proxy authentication challenge is specified.");
|
||||||
|
|
||||||
|
var authChal = AuthenticationChallenge.Parse (chal);
|
||||||
|
if (authChal == null)
|
||||||
|
throw new WebSocketException ("An invalid proxy authentication challenge is specified.");
|
||||||
|
|
||||||
|
if (_proxyCredentials != null) {
|
||||||
|
if (res.HasConnectionClose) {
|
||||||
releaseClientResources ();
|
releaseClientResources ();
|
||||||
_tcpClient = new TcpClient (_proxyUri.DnsSafeHost, _proxyUri.Port);
|
_tcpClient = new TcpClient (_proxyUri.DnsSafeHost, _proxyUri.Port);
|
||||||
_stream = _tcpClient.GetStream ();
|
_stream = _tcpClient.GetStream ();
|
||||||
|
Loading…
Reference in New Issue
Block a user