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_protocol.c
Date Tue, 14 Nov 2000 06:07:40 GMT
rbb         00/11/13 22:07:40

  Modified:    src      CHANGES
               src/main http_protocol.c
  Log:
  Make the header filter decide if a body should be sent.  This gives us a
  chance to compute the proper content-length before we try to send a set
  of headers.  If a handler wants to ignore the HEAD method, then it can
  either just return from the handler function or pass an EOS bucket down
  the filter stack.  Either method will still get the headers sent to the
  client.
  
  This change allows handlers to actually run the request like it is a GET
  request.  The core itself will then ensure that no body is sent.  This
  allows us to get more information about the request before sending out the
  headers for the HEAD request.
  
  Revision  Changes    Path
  1.327     +9 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.326
  retrieving revision 1.327
  diff -u -r1.326 -r1.327
  --- CHANGES	2000/11/14 04:52:33	1.326
  +++ CHANGES	2000/11/14 06:07:40	1.327
  @@ -1,4 +1,13 @@
   Changes with Apache 2.0a8
  +  *) The Header filter can now determine if a body should be sent based
  +     on r->header_only.  The general idea of this is that if we delay
  +     deciding to send the body, then we might be able to compute the
  +     content-length correctly, which will help caching proxies to cache
  +     our data better.  Any handler that doesn't want to try to compute
  +     the content-length can just send an EOS bucket without data and
  +     everything will just work.
  +     [Ryan Bloom]
  +
     *) If the Content-Length is zero, we shouldn't output that header
        field.  The only time that this field should ever be zero, is if the
        request has no body.  But, if it is a HEAD request then we should
  
  
  
  1.244     +18 -0     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.243
  retrieving revision 1.244
  diff -u -r1.243 -r1.244
  --- http_protocol.c	2000/11/14 04:52:33	1.243
  +++ http_protocol.c	2000/11/14 06:07:40	1.244
  @@ -2410,6 +2410,9 @@
       return num_ranges;
   }
   
  +typedef struct header_filter_cts {
  +    int headers_sent;
  +} header_filter_ctx;
   AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bucket_brigade
*b)
   {
       int i;
  @@ -2420,9 +2423,19 @@
       ap_bucket_brigade *b2;
       apr_size_t len = 0;
       header_struct h;
  +    header_filter_ctx *ctx = f->ctx;
   
       AP_DEBUG_ASSERT(!r->main);
   
  +    if (!ctx) {
  +        ctx = apr_pcalloc(r->pool, sizeof(*ctx));
  +    }
  +
  +    if (ctx->headers_sent) {
  +        ap_brigade_destroy(b);
  +        return AP_REQUEST_DONE;
  +    }
  +
       if (r->assbackwards) {
           r->bytes_sent = 0;
           r->sent_bodyct = 1;
  @@ -2519,6 +2532,11 @@
       e = ap_bucket_create_pool(buff_start, strlen(buff_start), r->pool);
       AP_BRIGADE_INSERT_HEAD(b2, e);
       ap_pass_brigade(f->next, b2);
  +
  +    if (r->header_only) {
  +        ap_brigade_destroy(b);
  +        return AP_REQUEST_DONE;
  +    }
   
       if (r->chunked) {
           /* The coalesce filter is useful to coalesce content from the ap_r*
  
  
  

Mime
View raw message