SetCookies() public method

public SetCookies ( WebSocketSharp.Net.CookieCollection cookies ) : void
cookies WebSocketSharp.Net.CookieCollection
return void
コード例 #1
0
        // As client
        private HandshakeRequest createHandshakeRequest()
        {
            var path = _uri.PathAndQuery;
              var host = _uri.Port == 80
               ? _uri.DnsSafeHost
               : _uri.Authority;

              var req = new HandshakeRequest (path);
              req.AddHeader ("Host", host);

              if (_origin.Length > 0)
            req.AddHeader ("Origin", _origin);

              req.AddHeader ("Sec-WebSocket-Key", _base64key);

              if (!_protocols.IsNullOrEmpty ())
            req.AddHeader ("Sec-WebSocket-Protocol", _protocols);

              var extensions = createRequestExtensions ();
              if (extensions.Length > 0)
            req.AddHeader ("Sec-WebSocket-Extensions", extensions);

              req.AddHeader ("Sec-WebSocket-Version", _version);

              if (_preAuth && _credentials != null)
            req.SetAuthorization (new AuthenticationResponse (_credentials));

              if (_cookies.Count > 0)
            req.SetCookies (_cookies);

              return req;
        }
コード例 #2
0
ファイル: WebSocket.cs プロジェクト: jijamw/websocket-sharp
        // As client
        private HandshakeRequest createHandshakeRequest()
        {
            var path = _uri.PathAndQuery;
              var host = _uri.Port == 80 ? _uri.DnsSafeHost : _uri.Authority;

              var req = new HandshakeRequest (path);
              var headers = req.Headers;

              headers ["Host"] = host;

              if (!_origin.IsNullOrEmpty ())
            headers ["Origin"] = _origin;

              headers ["Sec-WebSocket-Key"] = _base64Key;

              if (_protocols != null)
            headers ["Sec-WebSocket-Protocol"] = _protocols.ToString (", ");

              var extensions = createExtensionsRequest ();
              if (extensions != null)
            headers ["Sec-WebSocket-Extensions"] = extensions;

              headers ["Sec-WebSocket-Version"] = _version;

              AuthenticationResponse authRes = null;
              if (_authChallenge != null && _credentials != null) {
            authRes = new AuthenticationResponse (_authChallenge, _credentials, _nonceCount);
            _nonceCount = authRes.NonceCount;
              }
              else if (_preAuth)
            authRes = new AuthenticationResponse (_credentials);

              if (authRes != null)
            headers ["Authorization"] = authRes.ToString ();

              if (_cookies.Count > 0)
            req.SetCookies (_cookies);

              return req;
        }