]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Update ap_send_fd() and ap_send_fd_length() to use an ap_file_t. Hummm...
authorBill Stoddard <stoddard@apache.org>
Tue, 5 Oct 1999 05:14:43 +0000 (05:14 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 5 Oct 1999 05:14:43 +0000 (05:14 +0000)
Still need to get sendfile() in. First, lets get the serving basically
working again :-)

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

include/http_protocol.h
modules/http/http_core.c
modules/http/http_protocol.c

index e962b962c9c23e5b0cc0b301114e0c87436885f9..eab522e972de72e6eeb3609c81fc51e09d960d95 100644 (file)
@@ -134,8 +134,8 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r);
  * (Ditto the send_header stuff).
  */
 
-API_EXPORT(long) ap_send_fd(int fd, request_rec *r);
-API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length);
+API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r);
+API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length);
 
 API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r);
 API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length);
index 2c306e33d5b017e227e7b32a8cc735dd0053d92b..c1b23789b24a8b7347ed32366f3fb3f82db46878 100644 (file)
@@ -2579,7 +2579,7 @@ static int default_handler(request_rec *r)
        
        if (!r->header_only) {
            if (!rangestatus) {
-               ap_send_fd(fd_os, r);
+               ap_send_fd(fd, r);
            }
            else {
                long     length;
@@ -2592,7 +2592,7 @@ static int default_handler(request_rec *r)
                        ap_close(fd);
                        return HTTP_INTERNAL_SERVER_ERROR;
                    }
-                   ap_send_fd_length(fd_os, r, length);
+                   ap_send_fd_length(fd, r, length);
                }
            }
        }
index 5836f6110ed8e9c6fe20dace9f5040a50d9c91b8..cd5e0c81a3b5cb3dbbe0f5c8a0d880516df1c635 100644 (file)
@@ -1999,16 +1999,18 @@ API_EXPORT(int) ap_discard_request_body(request_rec *r)
 /*
  * Send the body of a response to the client.
  */
-API_EXPORT(long) ap_send_fd(int fd, request_rec *r)
+API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r)
 {
     return ap_send_fd_length(fd, r, -1);
 }
 
-API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length)
+API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length)
 {
     char buf[IOBUFSIZE];
     long total_bytes_sent = 0;
-    register int n, w, o;
+    register w, o;
+    int n;
+    ap_status_t status;
 
     if (length == 0)
         return 0;
@@ -2018,15 +2020,17 @@ API_EXPORT(long) ap_send_fd_length(int fd, request_rec *r, long length)
             o = length - total_bytes_sent;
         else
             o = IOBUFSIZE;
+        
+        n = o;
+        do {
+            status = ap_read(fd, buf, &n);
+        } while (status == APR_EINTR && !ap_is_aborted(r->connection) &&
+                 (n < 1));
 
-        while ((n = read(fd, buf, o)) < 0 && 
-                (errno == EINTR || errno == EAGAIN) && 
-                !ap_is_aborted(r->connection))
-            continue;
-            
         if (n < 1) {
             break;
         }
+
         o = 0;
 
         while (n && !ap_is_aborted(r->connection)) {