Loading CHANGES +4 −0 Changes for CHANGES: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] *) mod_charset_lite: Remove Content-Length when output filter can invalidate it. Warn when input filter can invalidate it. [Jeff Trawick] *) Ensure that the proper status line is written to the client, fixing incorrect status lines caused by filters which modify r->status without resetting r->status_line, such as the built-in byterange filter. Loading modules/filters/mod_charset_lite.c +26 −0 Changes for modules/filters/mod_charset_lite.c: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ typedef struct charset_dir_t { */ typedef struct charset_filter_ctx_t { apr_xlate_t *xlate; int is_sb; /* single-byte translation? */ charset_dir_t *dc; ees_t ees; /* extended error status */ apr_size_t saved; Loading Loading @@ -323,6 +324,9 @@ static int find_code_page(request_rec *r) dc->charset_default, dc->charset_source); return HTTP_INTERNAL_SERVER_ERROR; } if (apr_xlate_sb_get(input_ctx->xlate, &input_ctx->is_sb) != APR_SUCCESS) { input_ctx->is_sb = 0; } } return DECLINED; Loading Loading @@ -862,6 +866,11 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) dc->charset_source, dc->charset_default); ctx->noop = 1; } else { if (apr_xlate_sb_get(ctx->xlate, &ctx->is_sb) != APR_SUCCESS) { ctx->is_sb = 0; } } } else { ctx->noop = 1; Loading @@ -883,6 +892,12 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) if (!ctx->ran) { /* filter never ran before */ chk_filter_chain(f); ctx->ran = 1; if (!ctx->noop && !ctx->is_sb) { /* We're not converting between two single-byte charsets, so unset * Content-Length since it is unlikely to remain the same. */ apr_table_unset(f->r->headers_out, "Content-Length"); } } if (ctx->noop) { Loading Loading @@ -1041,6 +1056,17 @@ static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, if (!ctx->ran) { /* filter never ran before */ chk_filter_chain(f); ctx->ran = 1; if (!ctx->noop && !ctx->is_sb) { /* We're not converting between two single-byte charsets, so note * that some handlers can't deal with it. * It doesn't help to unset Content-Length in the input header * table since in all likelihood the handler has already seen it. */ if (dc->debug >= DBGLVL_PMC) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "Request body length may change, breaking some requests"); } } } if (ctx->noop) { Loading Loading
CHANGES +4 −0 Changes for CHANGES: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] *) mod_charset_lite: Remove Content-Length when output filter can invalidate it. Warn when input filter can invalidate it. [Jeff Trawick] *) Ensure that the proper status line is written to the client, fixing incorrect status lines caused by filters which modify r->status without resetting r->status_line, such as the built-in byterange filter. Loading
modules/filters/mod_charset_lite.c +26 −0 Changes for modules/filters/mod_charset_lite.c: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ typedef struct charset_dir_t { */ typedef struct charset_filter_ctx_t { apr_xlate_t *xlate; int is_sb; /* single-byte translation? */ charset_dir_t *dc; ees_t ees; /* extended error status */ apr_size_t saved; Loading Loading @@ -323,6 +324,9 @@ static int find_code_page(request_rec *r) dc->charset_default, dc->charset_source); return HTTP_INTERNAL_SERVER_ERROR; } if (apr_xlate_sb_get(input_ctx->xlate, &input_ctx->is_sb) != APR_SUCCESS) { input_ctx->is_sb = 0; } } return DECLINED; Loading Loading @@ -862,6 +866,11 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) dc->charset_source, dc->charset_default); ctx->noop = 1; } else { if (apr_xlate_sb_get(ctx->xlate, &ctx->is_sb) != APR_SUCCESS) { ctx->is_sb = 0; } } } else { ctx->noop = 1; Loading @@ -883,6 +892,12 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) if (!ctx->ran) { /* filter never ran before */ chk_filter_chain(f); ctx->ran = 1; if (!ctx->noop && !ctx->is_sb) { /* We're not converting between two single-byte charsets, so unset * Content-Length since it is unlikely to remain the same. */ apr_table_unset(f->r->headers_out, "Content-Length"); } } if (ctx->noop) { Loading Loading @@ -1041,6 +1056,17 @@ static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, if (!ctx->ran) { /* filter never ran before */ chk_filter_chain(f); ctx->ran = 1; if (!ctx->noop && !ctx->is_sb) { /* We're not converting between two single-byte charsets, so note * that some handlers can't deal with it. * It doesn't help to unset Content-Length in the input header * table since in all likelihood the handler has already seen it. */ if (dc->debug >= DBGLVL_PMC) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "Request body length may change, breaking some requests"); } } } if (ctx->noop) { Loading