Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to connect to ports other than 80 on Windows #106

Closed
stormont opened this issue Aug 11, 2015 · 0 comments
Closed

Fails to connect to ports other than 80 on Windows #106

stormont opened this issue Aug 11, 2015 · 0 comments

Comments

@stormont
Copy link
Contributor

Network.WebSockets.Client doesn't appear able to connect to ports other than port 80 on Windows. I'm not sure what the behavior is on *nix, but servers that guard their websocket spec against the full combination of host:port/path would seem to reject the current behavior (servers that use guards against host/path would work successfully, as would host:80/path).

My reproduction case is:

  1. Setup
  2. Configure
    • Change the port used by the C# server to 80.
    • Change the port used by the Haskell client to 80.
    • Change the path used by the Haskell client to be "/Echo".
    • main :: IO () now looks like this:
      main = withSocketsDo $ runClient2 "localhost" 80 "/Echo" app
    • Confirm that this configuration works when running both processes as an echo server/client with the above configuration.
  3. Modify
    • Revert the port used by the C# server to 4649 (the original definition).
    • Change the port used by the Haskell client to 4649.
    • Confirm that running this configuration causes the C# server to return BadRequest responses to the Haskell client.
  4. Culprit
    • Stepping through the C# server, it looks like the client was still connecting on port 80.
  5. Fix
    • Modify Network.WebSockets.Client.hs runClientWith function on line 66 to append the port to the host string when calling runClientWithSocket.
    • The line in runClientWith should now look like this:
      runClientWithSocket sock (host ++ ":" ++ show port) path opts customHeaders app)
    • Verify that the server and client can now communicate.

This seemed slightly related to issue #64, but with a different failure case. I'll submit a pull request with this change to runClientWith.

stormont added a commit to stormont/websockets that referenced this issue Aug 11, 2015
jaspervdj added a commit that referenced this issue Aug 25, 2015
Corrected issue #106 where client appears to always connect over port 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants