Fix fspr_socket_recv when receiving UDP with no data

This commit is contained in:
Tomasz Ostrowski 2023-07-01 19:32:58 +02:00 committed by GitHub
parent b355bf21e6
commit 9c32f38dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View File

@ -117,8 +117,9 @@ APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf,
return errno; return errno;
} }
(*len) = rv; (*len) = rv;
if (rv == 0) if (rv == 0 && sock->type == SOCK_STREAM)
return APR_EOF; return APR_EOF;
return APR_SUCCESS; return APR_SUCCESS;
} }
@ -205,7 +206,7 @@ APR_DECLARE(fspr_status_t) fspr_socket_recvfrom(fspr_sockaddr_t *from,
} }
(*len) = rv; (*len) = rv;
if (rv == 0) if (rv == 0 && sock->type == SOCK_STREAM)
return APR_EOF; return APR_EOF;
return APR_SUCCESS; return APR_SUCCESS;

View File

@ -100,7 +100,10 @@ APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf,
} }
(*len) = rv; (*len) = rv;
return rv == 0 ? APR_EOF : APR_SUCCESS; if (rv == 0 && sock->type == SOCK_STREAM)
return APR_EOF;
return APR_SUCCESS;
} }

View File

@ -105,9 +105,10 @@ do_select:
sock->options |= APR_INCOMPLETE_READ; sock->options |= APR_INCOMPLETE_READ;
} }
(*len) = rv; (*len) = rv;
if (rv == 0) { if (rv == 0 && sock->type == SOCK_STREAM) {
return APR_EOF; return APR_EOF;
} }
return APR_SUCCESS; return APR_SUCCESS;
} }

View File

@ -90,7 +90,10 @@ APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf,
} }
*len = dwBytes; *len = dwBytes;
return dwBytes == 0 ? APR_EOF : APR_SUCCESS; if (rv == 0 && sock->type == SOCK_STREAM)
return APR_EOF;
return APR_SUCCESS;
} }