Commit c9558f3b authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Set timeouts to sendfile operation in http_protocol.c. Fix bugs in Win32

sendfile implementation.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84543 13f79535-47bb-0310-9956-ffa450edef68
parent 877d97c4
Loading
Loading
Loading
Loading
+13 −3
Changes for modules/http/http_protocol.c: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2015,19 +2015,29 @@ API_EXPORT(int) ap_discard_request_body(request_rec *r)
 */
API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r)
{
    ap_status_t rv;
    long len = r->finfo.size;
#ifdef HAVE_SENDFILE
    if (!r->chunked) {
        ap_bsetopt(r->connection->client, BO_TIMEOUT,
                   r->connection->keptalive
                   ? &r->server->keep_alive_timeout
                   : &r->server->timeout);
        ap_bflush(r->connection->client);
        if (iol_sendfile(r->connection->client->iol, 
        rv = iol_sendfile(r->connection->client->iol, 
                          fd,     /* The file to send */
                          NULL,   /* header and trailer iovecs */
                          0,      /* Offset in file to begin sending from */
                          &len,
                         0) != APR_SUCCESS) {
            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
                          0);
        if (rv != APR_SUCCESS) {
            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                          "ap_send_fd: iol_sendfile failed.");
        }
        if (r->connection->keptalive) {
            ap_bsetopt(r->connection->client, BO_TIMEOUT, 
                       &r->server->timeout);
        }
    }
    else {
        len = ap_send_fd_length(fd, r, -1);