diff options
Diffstat (limited to 'modules/metadata/mod_mime_magic.c')
-rw-r--r-- | modules/metadata/mod_mime_magic.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index cd627911..867a4964 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -2099,13 +2099,15 @@ static int zmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes) if (i == ncompr) return 0; - if ((newsize = uncompress(r, i, &newbuf, nbytes)) > 0) { + if ((newsize = uncompress(r, i, &newbuf, HOWMANY)) > 0) { + /* set encoding type in the request record */ + r->content_encoding = compr[i].encoding; + + newbuf[newsize-1] = '\0'; /* null-terminate uncompressed data */ + /* Try to detect the content type of the uncompressed data */ if (tryit(r, newbuf, newsize, 0) != OK) { return 0; } - - /* set encoding type in the request record */ - r->content_encoding = compr[i].encoding; } return 1; } @@ -2121,7 +2123,6 @@ static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cn { int rc = 1; const char *new_argv[4]; - const char *const *env; request_rec *r = parm->r; apr_pool_t *child_context = cntxt; apr_procattr_t *procattr; @@ -2133,13 +2134,12 @@ static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cn * Should we create the err pipe, read it, and copy to the log? */ - env = (const char *const *)ap_create_environment(child_context, r->subprocess_env); - if ((apr_procattr_create(&procattr, child_context) != APR_SUCCESS) || (apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) || - (apr_procattr_dir_set(procattr, r->filename) != APR_SUCCESS) || - (apr_procattr_cmdtype_set(procattr, APR_PROGRAM) != APR_SUCCESS)) { + (apr_procattr_dir_set(procattr, + ap_make_dirstr_parent(r->pool, r->filename)) != APR_SUCCESS) || + (apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH) != APR_SUCCESS)) { /* Something bad happened, tell the world. */ ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r, "couldn't setup child process: %s", r->filename); @@ -2152,7 +2152,7 @@ static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cn procnew = apr_pcalloc(child_context, sizeof(*procnew)); rc = apr_proc_create(procnew, compr[parm->method].argv[0], - new_argv, env, procattr, child_context); + new_argv, NULL, procattr, child_context); if (rc != APR_SUCCESS) { /* Bad things happened. Everyone should have cleaned up. */ @@ -2473,5 +2473,3 @@ module AP_MODULE_DECLARE_DATA mime_magic_module = mime_magic_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; - - |