Skip to content

Disable decompression in mod_mime_magic by default#623

Open
notroj wants to merge 1 commit intoapache:trunkfrom
notroj:disable-magic
Open

Disable decompression in mod_mime_magic by default#623
notroj wants to merge 1 commit intoapache:trunkfrom
notroj:disable-magic

Conversation

@notroj
Copy link
Copy Markdown
Collaborator

@notroj notroj commented Mar 31, 2026

No description provided.

Copy link
Copy Markdown
Collaborator Author

@notroj notroj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filing the PR and especially for the docs update.

@@ -484,6 +488,7 @@ static void *merge_magic_server_config(apr_pool_t *p, void *basev, void *addv)
apr_palloc(p, sizeof(magic_server_config_rec));

new->magicfile = add->magicfile ? add->magicfile : base->magicfile;
new->decompression_enabled = add->decompression_enabled;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means the setting doesn't inherit properly across vhosts. The simplest way to do this properly is to have ->decomp_enabled default to an "UNSET" macro defined as -1, and then use a ternary operator to inherit in the merge = (add->decompress_enabled != UNSET) ? add->decompress_enabled : base->decompress_enabled. And also adjust the code that uses the field to special-case the UNSET value

ap_get_module_config(cmd->server->module_config,
&mime_magic_module);

if (!conf) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary, that can never return NULL (it's an array lookup).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants