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/main http_protocol.c
Date Wed, 26 Jul 2000 14:29:37 GMT
trawick     00/07/26 07:29:36

  Modified:    src/main http_protocol.c
  Log:
  packet minimization when doing sendfile...
  
  When preparing to call iol_sendfile(), don't call ap_bflush() first.
  Instead, pass the data ap_bflush() would have written (if any) to
  iol_sendfile() as a header.  In practice, this prevents sending headers
  separately from the first part of the file.
  Submitted by:	Greg Ames
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.98      +20 -2     apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- http_protocol.c	2000/07/21 19:50:47	1.97
  +++ http_protocol.c	2000/07/26 14:29:34	1.98
  @@ -2250,22 +2250,40 @@
   {
       ap_int32_t flags = 0;
       ap_status_t rv;
  +    struct iovec iov;
  +    ap_hdtr_t hdtr;
   
       ap_bsetopt(r->connection->client, BO_TIMEOUT,
                  r->connection->keptalive
                  ? &r->server->keep_alive_timeout
                  : &r->server->timeout);
   
  -    ap_bflush(r->connection->client);
  +    /*
  +     * We want to send any data held in the client buffer on the
  +     * call to iol_sendfile. So hijack it then set outcnt to 0
  +     * to prevent the data from being sent to the client again
  +     * when the buffer is flushed to the client at the end of the
  +     * request.
  +     */
  +    iov.iov_base = r->connection->client->outbase;
  +    iov.iov_len =  r->connection->client->outcnt;
  +    r->connection->client->outcnt = 0;
   
  +    /* initialize the ap_hdtr_t struct */
  +    hdtr.headers = &iov;
  +    hdtr.numheaders = 1;
  +    hdtr.trailers = NULL;
  +    hdtr.numtrailers = 0;
  +
       if (!r->connection->keepalive) {
           /* Prepare the socket to be reused */
  +        /* XXX fix me - byteranges? */
           flags |= APR_SENDFILE_DISCONNECT_SOCKET;
       }
   
       rv = iol_sendfile(r->connection->client->iol, 
                         fd,      /* The file to send */
  -                      NULL,    /* Header and trailer iovecs */
  +                      &hdtr,   /* Header and trailer iovecs */
                         &offset, /* Offset in file to begin sending from */
                         &length,
                         flags);
  
  
  

Mime
View raw message