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

Enable more networking specs on Windows #12176

Merged
merged 2 commits into from
Jul 3, 2022

Conversation

HertzDevil
Copy link
Contributor

With the event loop merged, a whole bunch of networking specs can be enabled now. Some are disabled or changed:

  • HTTP::Server reuses the TCP port (SO_REUSEPORT): This constant is not defined on Windows. The closest thing is probably SO_REUSEADDR | SO_EXCLUSIVEADDRUSE. This is not implemented here yet.
  • HTTP::WebSocket negotiates over HTTP correctly: The specs try to connect a TCP socket to 0.0.0.0, and ConnectEx does not support this; these specs now use 127.0.0.1. But see also https://superuser.com/a/1307057.
  • OAuth2::Client get_access_token_using_*: Those specs ultimately rely on non-blocking IO::FileDescriptors returned from IO.pipe. It seems file reads and writes on Windows are still blocking.
  • The others I don't fully understand why they fail yet.

The definition of LibC::Linger is copied from WinSock2.h.

std/socket/unix_server_spec.cr and std/socket/unix_socket_spec.cr are enabled because these files start with a skip_file now. Eventually we should do this to the rest of the failing spec files instead of having a separate win32_std_spec.cr, but that would be too much for this PR.

@HertzDevil HertzDevil added platform:windows Windows support based on the MSVC toolchain / Win32 API kind:specs topic:stdlib:networking labels Jun 30, 2022
Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @HertzDevil 🙏

@straight-shoota straight-shoota added this to the 1.5.0 milestone Jul 1, 2022
@straight-shoota straight-shoota merged commit 6a5ac59 into crystal-lang:master Jul 3, 2022
@HertzDevil HertzDevil deleted the spec/win32-network branch July 4, 2022 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:specs platform:windows Windows support based on the MSVC toolchain / Win32 API topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants