perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
Date Thu, 13 May 2004 01:45:30 GMT
stas        2004/05/12 18:45:30

  Modified:    src/modules/perl modperl_filter.c
  Log:
  - better tracing (show the actual data as in modperl_io_apache.c)
  - extra comments
  
  Revision  Changes    Path
  1.89      +28 -17    modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -u -r1.88 -r1.89
  --- modperl_filter.c	4 May 2004 06:19:11 -0000	1.88
  +++ modperl_filter.c	13 May 2004 01:45:30 -0000	1.89
  @@ -139,8 +139,8 @@
           const char *body;
           int status;
   
  -        MP_TRACE_f(MP_FUNC, "\n\n\tparsing headers: %d bytes [%s]\n", len,
  -                   apr_pstrmemdup(wb->pool, buf, len));
  +        MP_TRACE_f(MP_FUNC, "\n\n\tparsing headers: %db [%s]\n", len,
  +                   MP_TRACE_STR_TRUNC(wb->pool, buf, len));
           
           status = modperl_cgi_header_parse(r, (char *)buf, &len, &body);
   
  @@ -176,9 +176,10 @@
           APR_BRIGADE_INSERT_TAIL(bb, bucket);
       }
   
  -    MP_TRACE_f(MP_FUNC, "\n\n\twrite out: %d bytes\n"
  +    MP_TRACE_f(MP_FUNC, "\n\n\twrite out: %db [%s]\n"
                  "\t\tfrom %s\n\t\tto %s filter handler\n",
                  len, 
  +               MP_TRACE_STR_TRUNC(wb->pool, buf, len),
                  ((wb->r && wb->filters == &wb->r->output_filters)
                      ? "response handler" : "current filter handler"),
                  MP_FILTER_NAME(*(wb->filters)));
  @@ -589,17 +590,19 @@
       /*modperl_brigade_dump(filter->bb_in, stderr);*/
   
       MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
  -               "wanted: %d bytes\n",
  +               "wanted: %db\n",
                  MP_FILTER_NAME(filter->f),
                  wanted);
   
       if (filter->remaining) {
           if (filter->remaining >= wanted) {
               MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
  -                       "eating and returning %d of "
  -                       "remaining %d leftover bytes\n",
  +                       "eating and returning %d [%s]\n\tof "
  +                       "remaining %db\n",
                          MP_FILTER_NAME(filter->f),
  -                       wanted, filter->remaining);
  +                       wanted,
  +                       MP_TRACE_STR_TRUNC(filter->pool, filter->leftover, wanted),
  +                       filter->remaining);
               sv_catpvn(buffer, filter->leftover, wanted);
               filter->leftover += wanted;
               filter->remaining -= wanted;
  @@ -607,7 +610,7 @@
           }
           else {
               MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
  -                       "eating remaining %d leftover bytes\n",
  +                       "eating remaining %db\n",
                          MP_FILTER_NAME(filter->f),
                          filter->remaining);
               sv_catpvn(buffer, filter->leftover, filter->remaining);
  @@ -632,7 +635,7 @@
           if (filter->rc == APR_SUCCESS) {
               MP_TRACE_f(MP_FUNC,
                          MP_FILTER_NAME_FORMAT
  -                       "read in: %s bucket with %d bytes (0x%lx)\n",
  +                       "read in: %s bucket with %db (0x%lx)\n",
                          MP_FILTER_NAME(filter->f),
                          filter->bucket->type->name,
                          buf_len,
  @@ -665,9 +668,10 @@
   
       MP_TRACE_f(MP_FUNC,
                  MP_FILTER_NAME_FORMAT
  -               "return: %d bytes from %d bucket%s (%d bytes leftover)\n",
  +               "return: %db from %d bucket%s [%s]\n\t(%db leftover)\n",
                  MP_FILTER_NAME(filter->f),
                  len, num_buckets, ((num_buckets == 1) ? "" : "s"),
  +               MP_TRACE_STR_TRUNC(filter->pool, SvPVX(buffer), len),
                  filter->remaining);
   
       return len;
  @@ -785,11 +789,10 @@
       apr_bucket_alloc_t *ba = filter->f->c->bucket_alloc;
       char *copy = apr_pmemdup(filter->pool, buf, *len);
       apr_bucket *bucket = apr_bucket_transient_create(copy, *len, ba);
  -    /* MP_TRACE_f(MP_FUNC, "writing %d bytes: %s\n", *len, copy); */
       MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
  -               "write out: %d bytes:\n",
  -               MP_FILTER_NAME(filter->f),
  -               *len);
  +               "write out: %db [%s]:\n",
  +               MP_FILTER_NAME(filter->f), *len,
  +               MP_TRACE_STR_TRUNC(filter->pool, copy, *len));
       APR_BRIGADE_INSERT_TAIL(filter->bb_out, bucket);
       /* modperl_brigade_dump(filter->bb_out, stderr); */
       return APR_SUCCESS;
  @@ -882,11 +885,12 @@
       if ((av = dcfg->handlers_per_dir[idx])) {
           modperl_handler_t **handlers = (modperl_handler_t **)av->elts;
           int i;
  -        ap_filter_t *f;
   
           for (i=0; i<av->nelts; i++) {
               modperl_filter_ctx_t *ctx;
  +            ap_filter_t *f;
   
  +            /* process non-mod_perl filter handlers */
               if ((handlers[i]->attrs & MP_FILTER_HTTPD_HANDLER)) {
                   addfunc(handlers[i]->name, NULL, NULL, c);
                   MP_TRACE_f(MP_FUNC,
  @@ -895,9 +899,11 @@
                   continue;
               }
               
  +            /* skip non-connection level filters, e.g. request filters
  +             * configured outside the resource container */
               if (!(handlers[i]->attrs & MP_FILTER_CONNECTION_HANDLER)) {
                   MP_TRACE_f(MP_FUNC,
  -                           "%s is not a FilterConnection handler\n",
  +                           "%s is not a FilterConnection handler, skipping\n",
                              handlers[i]->name);
                   continue;
               }
  @@ -955,6 +961,7 @@
               int registered = 0;
               ap_filter_t *f;
   
  +            /* process non-mod_perl filter handlers */
               if ((handlers[i]->attrs & MP_FILTER_HTTPD_HANDLER)) {
                   addfunc(handlers[i]->name, NULL, r, r->connection);
                   MP_TRACE_f(MP_FUNC,
  @@ -963,9 +970,13 @@
                   continue;
               }
   
  +            /* skip non-request level filters, e.g. connection filters
  +             * configured outside the resource container, merged into
  +             * resource's dcfg->handlers_per_dir[] entry.
  +             */
               if ((handlers[i]->attrs & MP_FILTER_CONNECTION_HANDLER)) {
                   MP_TRACE_f(MP_FUNC,
  -                           "%s is not a FilterRequest handler\n",
  +                           "%s is not a FilterRequest handler, skipping\n",
                              handlers[i]->name);
                   continue;
               }
  
  
  

Mime
View raw message