]> granicus.if.org Git - apache/commitdiff
Set timeouts to sendfile operation in http_protocol.c. Fix bugs in Win32
authorBill Stoddard <stoddard@apache.org>
Mon, 31 Jan 2000 19:21:37 +0000 (19:21 +0000)
committerBill Stoddard <stoddard@apache.org>
Mon, 31 Jan 2000 19:21:37 +0000 (19:21 +0000)
sendfile implementation.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84543 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c

index 56bab15cd9bc999323d4b6f66c3b0a0a64d39df1..bf6ee4aaf623e8e5020e450b557c058c9aaeba48 100644 (file)
@@ -963,9 +963,9 @@ request_rec *ap_read_request(conn_rec *conn)
 #endif
 
     ap_bsetopt(conn->client, BO_TIMEOUT,
-        conn->keptalive
-            ? &r->server->keep_alive_timeout
-            : &r->server->timeout);
+               conn->keptalive
+               ? &r->server->keep_alive_timeout
+               : &r->server->timeout);
 
     /* Get the request... */
     if (!read_request_line(r)) {
@@ -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, 
-                         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,
+        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);
+        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);