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

http3+ngtcp2: ngtcp2.c doesn't build on Windows #4531

Closed
jblazquez opened this issue Oct 27, 2019 · 2 comments
Labels

Comments

@jblazquez
Copy link
Contributor

@jblazquez jblazquez commented Oct 27, 2019

I did this

I tried to build libcurl on Windows with HTTP/3 enabled against ngtcp2, but it failed with the following error:

lib\vquic\ngtcp2.c(1407,63): error C2065: 'MSG_DONTWAIT': undeclared identifier

MSG_DONTWAIT does not exist on Windows.

On Windows, one must set the socket to nonblocking mode in order for sendto and recvfrom to return WSAEWOULDBLOCK:

u_long nonblocking = 1;
ioctlsocket(sockfd, FIONBIO, &nonblocking);

How should libcurl handle this? The socket is not always created by libcurl itself. It could be created by the hosting application if it installed a CURLOPT_OPENSOCKETFUNCTION, and there's currently no way to request a nonblocking socket via that callback.

Should libcurl always set the UDP socket to nonblocking when creating it on behalf of ngtcp2?

I expected the following

I expected the build to succeed.

curl/libcurl version

curl commit: 0f234a5

operating system

Windows 10.

@bagder

This comment has been minimized.

Copy link
Member

@bagder bagder commented Oct 27, 2019

libcurl should probably set the socket to non-blocking even if passed in by the application

(I don't think anyone has tried this on windows before you...)

@jblazquez

This comment has been minimized.

Copy link
Contributor Author

@jblazquez jblazquez commented Oct 27, 2019

Sounds good, getting a PR ready then,

jblazquez added a commit to jblazquez/curl that referenced this issue Oct 28, 2019
The ngtcp2 QUIC backend was using the MSG_DONTWAIT flag for send/recv
in order to perform nonblocking operations. On Windows this flag does
not exist. Instead, the socket must be set to nonblocking mode via
ioctlsocket.

This change sets the nonblocking flag on UDP sockets used for QUIC on
all platforms so the use of MSG_DONTWAIT is not needed.

Fixes curl#4531
@bagder bagder closed this in e0ee3d9 Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.