httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c http_request.c
Date Sun, 05 Nov 2000 04:06:18 GMT
rbb         00/11/04 20:06:18

  Modified:    src      CHANGES
               src/main http_core.c http_request.c
  Log:
  Allow the core_output_filter to save data in the filter past the end of
  the first request if this is a keepalive connection.  This allows us to
  save the end of the first request until we have enough data from the
  second request to make it worthwhile to send the responses.  In order
  to do this, we need to allocate mmap's from the connection pool instead
  of the request pool.  If we don't use the connection pool, then the mmap
  is freed before the data is sent, because the mmap is freed at the end of
  the first request.
  
  Revision  Changes    Path
  1.308     +8 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.307
  retrieving revision 1.308
  diff -u -r1.307 -r1.308
  --- CHANGES	2000/11/04 16:34:45	1.307
  +++ CHANGES	2000/11/05 04:06:16	1.308
  @@ -1,4 +1,12 @@
   Changes with Apache 2.0a8
  +  *) Allow the core_output_filter to save some data past the end of a
  +     request.  If we get an EOS bucket, we only send the data if it 
  +     makes sense to send it.  This allows us to pipeline request
  +     responses.  As a part of this, we also need to allocate mmap
  +     buckets out of the connection pool, not the request pool.  This
  +     allows the mmap to outlive the request.
  +     [Ryan Bloom]
  +
     *) Make blocking and non-blocking bucket reads work correctly for
        sockets and pipes.  These are the only bucket types that should
        have non-blocking reads, because the other bucket types should
  
  
  
  1.202     +11 -2     apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.201
  retrieving revision 1.202
  diff -u -r1.201 -r1.202
  --- http_core.c	2000/11/04 01:30:37	1.201
  +++ http_core.c	2000/11/05 04:06:17	1.202
  @@ -2979,7 +2979,7 @@
   	/* we need to protect ourselves in case we die while we've got the
    	 * file mmapped */
           apr_status_t status;
  -        if ((status = apr_mmap_create(&mm, fd, 0, r->finfo.size, r->pool)) !=
APR_SUCCESS) {
  +        if ((status = apr_mmap_create(&mm, fd, 0, r->finfo.size, r->connection->pool))
!= APR_SUCCESS) {
   	    ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r,
   			 "default_handler: mmap failed: %s", r->filename);
   	    mm = NULL;
  @@ -3414,7 +3414,16 @@
           /* Completed iterating over the brigades, now determine if we want to
            * buffer the brigade or send the brigade out on the network
            */
  -        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) &&
!AP_BUCKET_IS_EOS(e) && !AP_BUCKET_IS_FLUSH(e)) {
  +        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) &&
!AP_BUCKET_IS_FLUSH(e) || (AP_BUCKET_IS_EOS(e) && c->keepalive)) {
  +            
  +            /* NEVER save an EOS in here.  If we are saving a brigade with an
  +             * EOS bucket, then we are doing keepalive connections, and we want
  +             * to process to second request fully.
  +             */
  +            if (AP_BUCKET_IS_EOS(e)) {
  +                AP_BUCKET_REMOVE(e);
  +                ap_bucket_destroy(e);
  +            }
               ap_save_brigade(f, &ctx->b, &b);
               return APR_SUCCESS;
           }
  
  
  
  1.68      +17 -1     apache-2.0/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_request.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- http_request.c	2000/10/24 16:57:53	1.67
  +++ http_request.c	2000/11/05 04:06:17	1.68
  @@ -1367,6 +1367,22 @@
       ap_finalize_request_protocol(r);
   }
   
  +static void check_pipeline_flush(request_rec *r)
  +{
  +    ap_bucket_brigade *bb = ap_brigade_create(r->pool);
  +    if (ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK) != APR_SUCCESS) {
  +        ap_bucket *e = ap_bucket_create_flush();
  +
  +        /* We just send directly to the connection based filters, because at
  +         * this point, we know that we have seen all of the data, so we just
  +         * want to flush the buckets if something hasn't been sent to the
  +         * network yet.
  +         */
  +        AP_BRIGADE_INSERT_HEAD(bb, e);
  +        ap_pass_brigade(r->connection->output_filters, bb);
  +    }
  +}
  +
   void ap_process_request(request_rec *r)
   {
       process_request_internal(r);
  @@ -1378,7 +1394,7 @@
        * this packet, then it'll appear like the link is stalled when really
        * it's the application that's stalled.
        */
  -    ap_bhalfduplex(r->connection->client);
  +    check_pipeline_flush(r);
       ap_run_log_transaction(r);
   }
   
  
  
  

Mime
View raw message