Commit 6c388d2f authored by Wilfredo Sanchez's avatar Wilfredo Sanchez
Browse files

In emulate_sendfile(), handle APR_EAGAIN from apr_socket_send().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@160348 13f79535-47bb-0310-9956-ffa450edef68
parent 68abb228
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -520,7 +520,8 @@ static apr_status_t emulate_sendfile(core_net_rec *c, apr_file_t *fd,
        sendlen = togo > sizeof(buffer) ? sizeof(buffer) : togo;
        o = 0;
        rv = apr_file_read(fd, buffer, &sendlen);
        while (rv == APR_SUCCESS && sendlen) {
        if (rv == APR_SUCCESS && sendlen) {
            while ((rv == APR_SUCCESS || rv == APR_EAGAIN) && sendlen) {
                bytes_sent = sendlen;
                rv = apr_socket_send(c->client_socket, &buffer[o], &bytes_sent);
                *nbytes += bytes_sent;
@@ -531,6 +532,7 @@ static apr_status_t emulate_sendfile(core_net_rec *c, apr_file_t *fd,
                }
            }
        }
    }

    /* Send the trailers
     * XXX: optimization... if it will fit, send this on the last send in the