From 7925eb1766a00ccee05c6e80b1d34f163a04b7b1 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Tue, 30 Jan 2018 09:43:34 +0800 Subject: [PATCH 4/7] Fix packet discards HTTP redirect. Disconnect the connection by poll() timeout. If timeout=0 and apr_wait_for_io_or_timeout()=APR_TIMEUP then apr_socket_recv() returns EAGAIN. Upstream-Status: Pending Signed-off-by: Noriaki Yoshitane Signed-off-by: Li Wang Rebase to 1.6.3 Signed-off-by: Hongxu Jia --- network_io/unix/sendrecv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 4c0e0a6..1bdafba 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -85,6 +85,10 @@ apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) && (sock->timeout > 0)) { do_select: arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + if ((arv == APR_TIMEUP) && (sock->timeout == 0)) { + *len = 0; + return EAGAIN; + } if (arv != APR_SUCCESS) { *len = 0; return arv; -- 1.8.3.1