httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: [PATCH] mod_include incorrect function table offset
Date Tue, 17 Apr 2001 23:57:56 GMT
Hey Rob,
Just a couple of comments on patch posting protocol (but not the code)...

1. Unified diffs are easier than context diffs to review (diff -u blah rather than diff -C3
blah).
We document for folks to use context diffs because unified diff is not available on all OSes
but
most of us prefer reviewing unified diffs. So post unified diffs if possible.

2. Your mail program folded some of the longer lines which will prevent this patch from applying
cleanly w/o tweaking.

Keeping these two points in mind will help getting your patch reviewed and committed.

Thanks for the fix.

Bill

----- Original Message -----
From: "RCHAPACH Rochester" <rchapach@us.ibm.com>
To: <new-httpd@apache.org>
Sent: Tuesday, April 17, 2001 5:13 PM
Subject: [PATCH] mod_include incorrect function table offset


> >From a co-worker of mine...
>
> Rob Simonson
> simo@us.ibm.com
>
> -------------------------------------------------
>
>
> Rob,
>
> I have described here the error I have encountered, and the fix I have done
> in order to get mod_include to work correctly.  The problem I encountered
> was in the send_parsed_content subroutine in mod_include.  The code as is
> currently obtained from the Apache Software Foundation does not determine
> the correct offset into the function table that is set up at post_config
> time by mod_include.  The include handler functions are placed into a hash
> table, using the function name(i.e. 'echo',  'config', ' include', ...) and
> the length of the function, plus the null terminator.  The input to the
> hash routine must be the same when the functions are retrieved in order for
> function to be handled.  The code calls get_combined_directive to get the
> directive into the ctx control block.  This routine will set the directive,
> which is the entire field, from the start sequence to the end sequence,
> into the ctx control block, and set this directive length in the ctx.
> These fields are passed into the hash routine to find the include function
> name.  Since the function name and length are not the same as the directive
> and directive length in the ctx, the hash table entry for the include
> function is not found.
>
> I have changed the following code in order to get the directive and
> directive length passed to the hash routine to find the proper include
> function.
>
>
> Karen L. Richner
>
> --------------------------------------------------
>
> ***************
> *** 2352,2357 ****
> --- 2352,2359 ----
>       apr_bucket *dptr = APR_BRIGADE_FIRST(*bb);
>       apr_bucket *tmp_dptr;
>       apr_bucket_brigade *tag_and_after;
> +     char *c;
> +     int dirlen;
>       int ret;
>
>       if (r->args) {              /* add QUERY stuff to env cause it ain't
> yet */
> ***************
> *** 2508,2523 ****
>                *  it NULL terminated (and include the NULL in the length)
> for proper
>                *  hash matching.
>                */
> !             for (tmp_i = 0; tmp_i < ctx->directive_length; tmp_i++) {
>                   ctx->combined_tag[tmp_i] =
> apr_tolower(ctx->combined_tag[tmp_i]);
>               }
> !             ctx->combined_tag[ctx->directive_length] = '\0';
> !             ctx->curr_tag_pos =
> &ctx->combined_tag[ctx->directive_length+1];
>
>               handle_func =
>                   (int (*)(include_ctx_t *, apr_bucket_brigade **,
> request_rec *,
>                       ap_filter_t *, apr_bucket *, apr_bucket **))
> !                 apr_hash_get(include_hash, ctx->combined_tag,
> ctx->directive_length+1);
>               if (handle_func != NULL) {
>                   ret = (*handle_func)(ctx, bb, r, f, dptr, &content_head);
>               }
> --- 2510,2533 ----
>                *  it NULL terminated (and include the NULL in the length)
> for proper
>                *  hash matching.
>                */
> !
> !        c = ctx->combined_tag;
> !        while ((*c != '\0') && (*c != ' ')) {
> !         c++;
> !        }
> !        dirlen = c - ctx->combined_tag;
> !
> !             for (tmp_i = 0; tmp_i < dirlen; tmp_i++) {
>                   ctx->combined_tag[tmp_i] =
> apr_tolower(ctx->combined_tag[tmp_i]);
>               }
> !             ctx->combined_tag[dirlen] = '\0';
> !        ctx->curr_tag_pos = &ctx->combined_tag[dirlen+1];
>
> +
>               handle_func =
>                   (int (*)(include_ctx_t *, apr_bucket_brigade **,
> request_rec *,
>                       ap_filter_t *, apr_bucket *, apr_bucket **))
> !                 apr_hash_get(include_hash, ctx->combined_tag, dirlen+1);
>               if (handle_func != NULL) {
>                   ret = (*handle_func)(ctx, bb, r, f, dptr, &content_head);
>               }
>
>
>


Mime
View raw message