joes        2003/10/23 12:07:29

  Modified:    env      mod_apreq.c
  Log:
  Drop some debugging logs, and do a bit more refactoring (cut down on the 
internal apreq_env* calls, some of which - especially apreq_env_request() - had 
unintended side-effects). Also bump apreq_env_magic_number to reflect the 
bugfixes made over the last 24 hours.
  
  Revision  Changes    Path
  1.32      +10 -21    httpd-apreq-2/env/mod_apreq.c
  
  Index: mod_apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/mod_apreq.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- mod_apreq.c       23 Oct 2003 11:21:16 -0000      1.31
  +++ mod_apreq.c       23 Oct 2003 19:07:29 -0000      1.32
  @@ -83,7 +83,7 @@
    */
   
   const char apreq_env_name[] = "APACHE2"; /**< internal name of module */
  -const unsigned int apreq_env_magic_number = 20031014; /**< ABI version */
  +const unsigned int apreq_env_magic_number = 20031023; /**< ABI version */
   
   /** The warehouse. */
   struct env_config {
  @@ -207,14 +207,13 @@
   {
       dR;
       struct env_config *c = get_cfg(r);
  +
       if (c->f == NULL)
           get_apreq_filter(r);
   
       if (req != NULL) {
           apreq_request_t *old = c->req;
           c->req = req;
  -        apreq_log(APREQ_DEBUG 0, r, 
  -                  "apreq request is now initialized (%d)", req);
           return old;
       }
   
  @@ -232,8 +231,6 @@
       ctx->spool   = apr_brigade_create(r->pool, alloc);
       ctx->status  = APR_INCOMPLETE;
       ctx->saw_eos = 0;
  -    apreq_log(APREQ_DEBUG 0, r, 
  -              "apreq filter context created." );    
   }
   
   /**
  @@ -249,8 +246,6 @@
       struct filter_ctx *ctx;
       apr_status_t s;
   
  -    if (f == NULL)
  -        return APR_NOTFOUND;
       if (f->ctx == NULL)
           apreq_filter_make_context(f);
       ctx = f->ctx;
  @@ -265,7 +260,6 @@
   }
   
   
  -
   static apr_status_t apreq_filter_init(ap_filter_t *f)
   {
       request_rec *r = f->r;
  @@ -292,8 +286,8 @@
            */
   
           if (!APR_BRIGADE_EMPTY(ctx->spool)) {
  -            apreq_request_t *req = apreq_env_request(r, NULL);
               struct env_config *cfg = get_cfg(r);
  +            apreq_request_t *req = cfg->req;
   
               /* Adding "f" to the protocol filter chain ensures the 
                * spooled data is preserved across internal redirects.
  @@ -326,17 +320,6 @@
               apreq_filter_relocate(f);
           }
       } 
  -    else {
  -        apr_bucket_alloc_t *alloc = apr_bucket_alloc_create(r->pool);
  -        ctx = apr_palloc(r->pool, sizeof *ctx);
  -        f->ctx       = ctx;
  -        ctx->bb      = apr_brigade_create(r->pool, alloc);
  -        ctx->spool   = apr_brigade_create(r->pool, alloc);
  -        ctx->status  = APR_INCOMPLETE;
  -        ctx->saw_eos = 0;
  -        apreq_log(APREQ_DEBUG 0, r, 
  -                  "apreq filter is initialized (%d)", f);
  -    }
   
       return APR_SUCCESS;
   }
  @@ -367,7 +350,7 @@
           return APR_ENOTIMPL;
       }
   
  -    req = apreq_request(r, NULL);
  +    req = get_cfg(r)->req;
   
       if (bb != NULL) {
   
  @@ -409,13 +392,19 @@
               return ctx->status;
           }
   
  +        /* assert(req); */
  +
       }
       else if (!ctx->saw_eos) {
  +
           /* prefetch read! */
  +
           apr_bucket_brigade *tmp = apr_brigade_create(r->pool, 
                                         apr_bucket_alloc_create(r->pool));
           apr_bucket *last = APR_BRIGADE_LAST(ctx->spool);
           apr_size_t total_read = 0;
  +
  +        /* assert(req); */
   
           while (total_read < readbytes) {
               apr_off_t len;
  
  
  

Reply via email to