1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 17:18:48 -05:00

HTTP3: fix invalid use of sendto for connected UDP socket

On macOS/BSD, trying to call sendto on a connected UDP socket fails
with a EISCONN error. Because the singleipconnect has already called
connect on the socket when we're trying to use it for QUIC transfers
we need to use plain send instead.

Fixes #4529
Closes https://github.com/curl/curl/pull/4533
This commit is contained in:
Javier Blazquez 2019-10-27 17:16:24 -07:00 committed by Jay Satiro
parent aeafa260ca
commit 9f5b26d23f

View File

@ -1544,9 +1544,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
} }
memcpy(&remote_addr, ps.path.remote.addr, ps.path.remote.addrlen); memcpy(&remote_addr, ps.path.remote.addr, ps.path.remote.addrlen);
while((sent = sendto(sockfd, out, outlen, 0, while((sent = send(sockfd, out, outlen, 0)) == -1 &&
(struct sockaddr *)&remote_addr,
(socklen_t)ps.path.remote.addrlen)) == -1 &&
SOCKERRNO == EINTR) SOCKERRNO == EINTR)
; ;
@ -1556,7 +1554,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
break; break;
} }
else { else {
failf(conn->data, "sendto() returned %zd (errno %d)\n", sent, failf(conn->data, "send() returned %zd (errno %d)\n", sent,
SOCKERRNO); SOCKERRNO);
return CURLE_SEND_ERROR; return CURLE_SEND_ERROR;
} }