From cbd31f67823e2ba279c6f93aa2541b0571286641 Mon Sep 17 00:00:00 2001 From: konn Date: Thu, 3 Jul 2008 19:41:28 +0000 Subject: [PATCH] * Changed jxhtml (remove _chxj_cc parameter). git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_12_0@2795 1a406e8e-add9-4483-a2c8-d8cac5b7c224 --- src/chxj_jxhtml.c | 5 ----- src/mod_chxj.c | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/chxj_jxhtml.c b/src/chxj_jxhtml.c index 85743d3d..3768dc47 100644 --- a/src/chxj_jxhtml.c +++ b/src/chxj_jxhtml.c @@ -722,7 +722,6 @@ s_jxhtml_start_meta_tag(void *pdoc, Node *node) sec[url-buf] = 0; url++; url = chxj_encoding_parameter(r, url); - url = chxj_add_cookie_parameter(r, url, jxhtml->cookie); W_L(" "); W_V(name); W_L("=\""); @@ -1057,7 +1056,6 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node) /* CHTML1.0 */ /*----------------------------------------------------------------------*/ value = chxj_encoding_parameter(r, value); - value = chxj_add_cookie_parameter(r, value, jxhtml->cookie); W_L(" href=\""); W_V(value); W_L("\""); @@ -1422,7 +1420,6 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node) /*----------------------------------------------------------------------*/ /* CHTML 1.0 */ /*----------------------------------------------------------------------*/ - value = chxj_add_cookie_parameter(r, value, jxhtml->cookie); W_L(" action=\""); W_V(value); W_L("\""); @@ -2065,7 +2062,6 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node) /*----------------------------------------------------------------------*/ #ifdef IMG_NOT_CONVERT_FILENAME value = chxj_encoding_parameter(r, value); - value = chxj_add_cookie_parameter(r, value, jxhtml->cookie); if (value) { value = apr_psprintf(r->pool, "%s%c%s=true", @@ -2079,7 +2075,6 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node) #else value = chxj_img_conv(r, spec, value); value = chxj_encoding_parameter(r, value); - value = chxj_add_cookie_parameter(r, value, jxhtml->cookie); if (value) { value = apr_psprintf(r->pool, "%s%c%s=true", diff --git a/src/mod_chxj.c b/src/mod_chxj.c index b78592b3..75fa452a 100644 --- a/src/mod_chxj.c +++ b/src/mod_chxj.c @@ -321,7 +321,6 @@ chxj_convert(request_rec *r, const char **src, apr_size_t *len, device_table *sp case CHXJ_SPEC_Chtml_6_0: case CHXJ_SPEC_Chtml_7_0: case CHXJ_SPEC_Jhtml: - case CHXJ_SPEC_Jxhtml: cookie = chxj_save_cookie(r); break; default: @@ -729,7 +728,6 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) apr_status_t rv; apr_bucket *b; const char *data; - char *contentLength; char *user_agent = NULL; apr_size_t len; mod_chxj_ctx *ctx = (mod_chxj_ctx *)f->ctx; @@ -776,7 +774,6 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) case CHXJ_SPEC_Chtml_6_0: case CHXJ_SPEC_Chtml_7_0: case CHXJ_SPEC_Jhtml: - case CHXJ_SPEC_Jxhtml: chxj_cookie_lock(r); cookie = chxj_save_cookie(r); s_add_cookie_id_if_has_location_header(r, cookie); @@ -786,6 +783,11 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) break; } } + if (apr_table_get(r->headers_out, "Location") || apr_table_get(r->err_headers_out, "Location")) { + if (r->status < HTTP_MULTIPLE_CHOICES || r->status > HTTP_TEMPORARY_REDIRECT) { + r->status = HTTP_MOVED_TEMPORARILY; + } + } ap_pass_brigade(f->next, bb); return APR_SUCCESS; } @@ -945,8 +947,15 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) } } - contentLength = apr_psprintf(pool, "%d", (int)ctx->len); - apr_table_setn(r->headers_out, "Content-Length", contentLength); + apr_table_unset(r->headers_out, "Content-Length"); + apr_table_unset(r->err_headers_out, "Content-Length"); + ap_set_content_length(r, (apr_off_t)ctx->len); + + if (apr_table_get(r->headers_out, "Location") || apr_table_get(r->err_headers_out, "Location")) { + if (r->status < HTTP_MULTIPLE_CHOICES || r->status > HTTP_TEMPORARY_REDIRECT) { + r->status = HTTP_MOVED_TEMPORARILY; + } + } if (ctx->len > 0) { DBG(r, "call pass_data_to_filter()"); @@ -978,7 +987,6 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) case CHXJ_SPEC_Chtml_6_0: case CHXJ_SPEC_Chtml_7_0: case CHXJ_SPEC_Jhtml: - case CHXJ_SPEC_Jxhtml: chxj_cookie_lock(r); cookie = chxj_save_cookie(r); /* @@ -992,6 +1000,11 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) break; } } + if (apr_table_get(r->headers_out, "Location") || apr_table_get(r->err_headers_out, "Location")) { + if (r->status < HTTP_MULTIPLE_CHOICES || r->status > HTTP_TEMPORARY_REDIRECT) { + r->status = HTTP_MOVED_TEMPORARILY; + } + } apr_table_setn(r->headers_out, "Content-Length", "0"); DBG(r, "call pass_data_to_filter()"); rv = pass_data_to_filter(f, (const char *)"", (apr_size_t)0); @@ -1013,6 +1026,9 @@ static void s_add_cookie_id_if_has_location_header(request_rec *r, cookie_t *cookie) { char *location_header = (char *)apr_table_get(r->headers_out, "Location"); + if (! location_header) { + location_header = (char *)apr_table_get(r->err_headers_out, "Location"); + } if (cookie && location_header) { DBG(r, "Location Header=[%s]", location_header); location_header = chxj_add_cookie_parameter(r, @@ -1105,6 +1121,7 @@ chxj_input_handler(request_rec *r) if ((chunked = (char *)apr_table_get(r->headers_out, "Transfer-Encoding")) != NULL) { if (strcasecmp(chunked, "chunked") == 0) { r->chunked = 1; + apr_table_unset(r->headers_out, "Transfer-Encoding"); } } { -- 2.11.0