httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/unix sendrecv.c
Date Tue, 27 Jun 2000 20:37:51 GMT
trawick     00/06/27 13:37:51

  Modified:    src/lib/apr/network_io/unix sendrecv.c
  Log:
  ap_sendfile() fixes for OS/390 and FreeBSD...
  
  OS/390: just use Victor's AIX flavor... it works for OS/390 as well
  
  FreeBSD: account for header bytes when we tell the kernel how much
           to send; prior to this fix, we wouldn't send as much of the
           file as desired if headers were provided
  
  Note:    APR_SO_TIMEOUT issues discussed on new-httpd today will be
           addressed later.  (one step at a time!)
  
  Revision  Changes    Path
  1.29      +23 -6     apache-2.0/src/lib/apr/network_io/unix/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sendrecv.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- sendrecv.c	2000/06/26 23:38:34	1.28
  +++ sendrecv.c	2000/06/27 20:37:50	1.29
  @@ -306,21 +306,30 @@
           		ap_int32_t flags)
   {
       off_t nbytes;
  -    int rv;
  +    int rv, i;
       struct sf_hdtr headerstruct;
  +    size_t bytes_to_send = *len;
   
  +    /* On FreeBSD, the number of bytes to send must include the length of
  +     * the headers.  Don't look at the man page for this :(  Instead, look
  +     * at the the logic in src/sys/kern/uipc_syscalls::sendfile().
  +     */
  +    
  +    for (i = 0; i < hdtr->numheaders; i++) {
  +        bytes_to_send += hdtr->headers[i].iov_len;
  +    }
  +
       headerstruct.headers = hdtr->headers;
       headerstruct.hdr_cnt = hdtr->numheaders;
       headerstruct.trailers = hdtr->trailers;
       headerstruct.trl_cnt = hdtr->numtrailers;
   
  -
       /* FreeBSD can send the headers/footers as part of the system call */
       do {
           rv = sendfile(file->filedes,	/* open file descriptor of the file to be sent
*/
           	      sock->socketdes,	/* socket */
           	      *offset,	/* where in the file to start */
  -        	      (size_t) * len,	/* number of bytes to send */
  +        	      bytes_to_send,    /* number of bytes to send */
           	      &headerstruct,	/* Headers/footers */
           	      &nbytes,	/* number of bytes written */
           	      flags	/* undefined, set to 0 */
  @@ -451,9 +460,17 @@
       (*len) = rv;
       return APR_SUCCESS;
   }
  -#elif defined(_AIX)
  -/* Need another check to make sure the dependencies are checked */
  -/* AIX, version 4.3.2 with APAR IX85388, or version 4.3.3 and above */
  +#elif defined(_AIX) || defined(__MVS__)
  +/* AIX and OS/390 have the same send_file() interface.
  + *
  + * subtle differences:
  + *   AIX doesn't update the file ptr but OS/390 does
  + *
  + * availability (correctly determined by autoconf):
  + *
  + * AIX -  version 4.3.2 with APAR IX85388, or version 4.3.3 and above
  + * OS/390 - V2R7 and above
  + */
   ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file,
                           ap_hdtr_t * hdtr, ap_off_t * offset, ap_size_t * len,
                           ap_int32_t flags)
  
  
  

Mime
View raw message