sta / sta/websocket-sharp

Server with SSL connection won't accept connection

Open
#234 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I have a server that works fine over regular connection. The client is a JavaScript script, using regular WebSockets.
Now I change the server to work over secured connection, set the certificate, server starts and listens for connection fine. Now when I change the JS client to work over wss:// protocol then server would not accept the connection and dump this in log file

3/16/2016 12:15:21 AM|Fatal|<>c__DisplayClass60_0.b__0|WebSocketSharp.WebSocketException: An exception has occurred while reading an HTTP request/response. ---> System.IO.EndOfStreamException: The header cannot be read from the data source.
at WebSocketSharp.HttpBase.<>c__DisplayClass13_0.b__0(Int32 i)
at WebSocketSharp.Ext.EqualsWith(Int32 value, Char c, Action1 action) at WebSocketSharp.HttpBase.readHeaders(Stream stream, Int32 maxLength) at WebSocketSharp.HttpBase.Read[T](Stream stream, Func2 parser, Int32 millisecondsTimeout)
--- End of inner exception stack trace ---
at WebSocketSharp.HttpBase.Read[T](Stream stream, Func`2 parser, Int32 millisecondsTimeout)
at WebSocketSharp.HttpRequest.Read(Stream stream, Int32 millisecondsTimeout)
at WebSocketSharp.Net.WebSockets.TcpListenerWebSocketContext..ctor(TcpClient tcpClient, String protocol, Boolean secure, ServerSslConfiguration sslConfig, Logger logger)
at WebSocketSharp.Ext.GetWebSocketContext(TcpClient tcpClient, String protocol, Boolean secure, ServerSslConfiguration sslConfig, Logger logger)
at WebSocketSharp.Server.WebSocketServer.<>c__DisplayClass60_0.b__0(Object state)

Any idea how this can be fixed?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at WebSocketServer.receiveRequest and TcpListenerWebSocketContext, then inspect HttpBase.readHeaders in the stack trace to trace how the secure connection is read. Reproduce the wss:// handshake with the JavaScript client and verify that the server accepts it without the reported EndOfStreamException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.