httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: httpd-2.0/server/mpm/perchild perchild.c
Date Wed, 06 Dec 2000 23:12:41 GMT
On Wed, Dec 06, 2000 at 09:12:07PM -0000, rbb@locus.apache.org wrote:
>...
>   @@ -1349,9 +1349,12 @@
>        perchild_server_conf *sconf = (perchild_server_conf *)
>                                ap_get_module_config(r->server->module_config, 
>                                                     &mpm_perchild_module);
>   -    char *foo = sconf->buffer;
>   -    int len = strlen(sconf->buffer);
>   +    char *foo;
>   +    int len;
>    
>   +    apr_get_userdata((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
>   +    len = strlen(foo);

Couldn't that content be binary data? The strlen() isn't going to work in
that case.

[ it could be binary on a file upload or a PUT ]

>...
>   @@ -1467,11 +1467,18 @@
>            return rv;
>        }
>    
>   +
>        AP_BRIGADE_FOREACH(e, b) {
>   -        const char *str;
>   +        char *buffer = NULL;
>   +	const char *str;
>            apr_size_t len;
>   +
>   +        apr_get_userdata((void **)&buffer, "PERCHILD_BUFFER", f->c->pool);
>   +
>            ap_bucket_read(e, &str, &len, AP_NONBLOCK_READ);
>   -        apr_pstrcat(f->r->pool, sconf->buffer, str);
>   +        apr_pstrcat(f->c->pool, buffer, str);
>   +
>   +        apr_set_userdata(&buffer, "PERCHILD_BUFFER", apr_null_cleanup, f->c->pool);

That set should probably be apr_set_userdata(buffer, ...) (no ampersand).

The apr_pstrcat() will also be a bit wonky with binary data. [not to mention
that the result value from the call isn't being used]

Finally: who places the buffer into the userdata in the first place?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message