質問

mod_deflateは常に送信します gzip 要求ヘッダーの場合のデータ Accept-Encodinggip, deflate.

mod_deflateに送信を好むように指示するにはどうすればよいですか deflate (いいえ zlib) それ以外の gzip?

これが不可能な場合...なぜDEVELPERSは、モジュールMOD_DEFLATEにデフレートできないときに名前を付けるのでしょうか。また、将来のリリースでこれを修正するためにバグレポートを提出するための最良の方法は何ですか?

役に立ちましたか?

解決

を見た後 mod_deflateのソースコード GZIP以外のものを送ることは不可能であるという結論に達しました。

今、私はそうではありません c プログラマーと私は自分でパッチをコミットできるとは思わない...しかし、ソースから、修正する必要があるものがいくつかあることがわかります(警告、私はCを書いたことはありません。だから、これはおそらくすべてひどく間違っている)

/* add this method */
static const char *deflate_set_preferred_method(cmd_parms *cmd, void *dummy,
                                const char *arg1)
{
    deflate_filter_config *c = ap_get_module_config(cmd->server->module_config,
                                                &deflate_module);

    if (arg2 != NULL && (!strcasecmp(arg1, "deflate") || !strcasecmp(arg1, "gzip") || !strcasecmp(arg1, "zlib") ) ) {
        c->preferred_method = apr_pstrdup(cmd->pool, arg1);
    }
    else {
        return apr_psprintf(cmd->pool, "Unknown preferred method type %s", arg1);
    }

    return NULL;
}

/* update some code to define "preferred_method" */


/* 
   Update all code that references the string "gzip" to take 
   into account "deflate", and "zlib" as well.

   This is the part I really have no clue how to do.
   lines: 539, 604, 607, 616, and 624 should be updates

   line 624 could read something like this: */

if( !strcasecmp(preferred_method,"gzip") ){
    /* add immortal gzip header */
    e = apr_bucket_immortal_create(gzip_header, sizeof gzip_header,
                                   f->c->bucket_alloc);
    APR_BRIGADE_INSERT_TAIL(ctx->bb, e);
}
else if( !strcasecmp(preferred_method, "zlib") ){
   /* do something to add the zlib headers here */
}

/* update this method */
static const command_rec deflate_filter_cmds[] = {
    AP_INIT_TAKE12("DeflateFilterNote", deflate_set_note, NULL, RSRC_CONF,
                  "Set a note to report on compression ratio"),
    AP_INIT_TAKE1("DeflateWindowSize", deflate_set_window_size, NULL,
                  RSRC_CONF, "Set the Deflate window size (1-15)"),
    AP_INIT_TAKE1("DeflateBufferSize", deflate_set_buffer_size, NULL, RSRC_CONF,
                  "Set the Deflate Buffer Size"),
    AP_INIT_TAKE1("DeflateMemLevel", deflate_set_memlevel, NULL, RSRC_CONF,
                  "Set the Deflate Memory Level (1-9)"),
    AP_INIT_TAKE1("DeflateCompressionLevel", deflate_set_compressionlevel, NULL, RSRC_CONF,
                  "Set the Deflate Compression Level (1-9)"),
    AP_INIT_TAKE1("DeflatePreferredMethod", deflate_set_preferred_method, NULL, RSRC_CONF,
                  "Set the Preferred Compression Method: deflate, gzip, or zlib (not-recommended)"),
    {NULL}
};
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top