/// <summary> /// Raises the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { this.StandardHttpRequestReceived(this, e); } }
/// <summary> /// Fires the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { // The event handler is to be fired, so set the Handled // property to true. If the user decides to let the non-handled // case happen, he can set the property to false in the event // handler. e.Handled = true; this.StandardHttpRequestReceived(this, e); } }
/// <summary> /// Fires the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (e == null) { throw new ArgumentNullException("e", "Event arguments cannot be null"); } if (this.StandardHttpRequestReceived != null) { // The event handler is to be fired, so set the Handled // property to true. If the user decides to let the non-handled // case happen, he can set the property to false in the event // handler. e.Handled = true; this.StandardHttpRequestReceived(this, e); } }
private void CreateHandler(IEnumerable <byte> dataToParse) { var request = this.parser.Parse(dataToParse.ToArray(), this.scheme); if (request == null) { return; } try { this.Handler = HandlerFactory.BuildHandler(request); } catch (WebSocketException) { StandardHttpRequestReceivedEventArgs e = new StandardHttpRequestReceivedEventArgs(this); this.OnStandardHttpRequestReceived(e); if (!e.Handled) { throw; } } if (this.Handler == null) { return; } this.Handler.TextMessageHandled += new EventHandler <TextMessageHandledEventArgs>(this.Handler_TextMessageHandled); this.Handler.BinaryMessageHandled += new EventHandler <BinaryMessageHandledEventArgs>(this.Handler_BinaryMessageHandled); this.Handler.CloseHandled += new EventHandler(this.Handler_CloseHandled); this.ConnectionInfo = WebSocketConnectionInfo.Create(request, this.Socket.RemoteIPAddress); var handshake = this.Handler.CreateHandshake(); this.SendBytes(handshake); this.OnOpen(new ConnectionEventArgs(this)); }
private void ConnectionStandardHttpRequestReceivedEventHandler(object sender, StandardHttpRequestReceivedEventArgs e) { this.OnStandardHttpRequestReceived(e); }
private void ServerStandardHttpRequestReceivedEventHandler(object sender, StandardHttpRequestReceivedEventArgs e) { const string PageSource = @"<!DOCTYPE html> <script> window.onload = function() {{ window.postMessage({{ 'type': 'connect', 'origin': 'webdriver', 'url': 'ws://localhost:{0}/wd' }}, '*'); }}; </script>"; string redirectPage = string.Format(CultureInfo.InvariantCulture, PageSource, this.webSocketServer.Port.ToString(CultureInfo.InvariantCulture)); StringBuilder builder = new StringBuilder(); builder.AppendLine("HTTP/1.1 200"); builder.AppendLine("Content-Length: " + redirectPage.Length.ToString(CultureInfo.InvariantCulture)); builder.AppendLine("Connection:close"); builder.AppendLine(); builder.AppendLine(redirectPage); e.Connection.SendRaw(builder.ToString()); }
private void CreateHandler(IEnumerable<byte> dataToParse) { var request = this.parser.Parse(dataToParse.ToArray(), this.scheme); if (request == null) { return; } try { this.Handler = HandlerFactory.BuildHandler(request); } catch (WebSocketException) { StandardHttpRequestReceivedEventArgs e = new StandardHttpRequestReceivedEventArgs(this); this.OnStandardHttpRequestReceived(e); if (!e.Handled) { throw; } } if (this.Handler == null) { return; } this.Handler.TextMessageHandled += new EventHandler<TextMessageHandledEventArgs>(this.Handler_TextMessageHandled); this.Handler.BinaryMessageHandled += new EventHandler<BinaryMessageHandledEventArgs>(this.Handler_BinaryMessageHandled); this.Handler.CloseHandled += new EventHandler(this.Handler_CloseHandled); this.ConnectionInfo = WebSocketConnectionInfo.Create(request, this.Socket.RemoteIPAddress); var handshake = this.Handler.CreateHandshake(); this.SendBytes(handshake); this.OnOpen(new ConnectionEventArgs(this)); }
/// <summary> /// Fires the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (e == null) { throw new ArgumentNullException("e", "Event arguments cannot be null"); } if (this.StandardHttpRequestReceived != null) { // The event handler is to be fired, so set the Handled // property to true. If the user decides to let the non-handled // case happen, he can set the property to false in the event // handler. e.Handled = true; this.StandardHttpRequestReceived(this, e); } }
private void ConnectionStandardHttpRequestReceivedEventHandler(object sender, StandardHttpRequestReceivedEventArgs e) { this.OnStandardHttpRequestReceived(e); }
/// <summary> /// Raises the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { this.StandardHttpRequestReceived(this, e); } }
/// <summary> /// Fires the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { // The event handler is to be fired, so set the Handled // property to true. If the user decides to let the non-handled // case happen, he can set the property to false in the event // handler. e.Handled = true; this.StandardHttpRequestReceived(this, e); } }