OSDN Git Service

Merge branch 'branch_0.12.0' into sandbox
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 24 Jul 2008 10:21:55 +0000 (10:21 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 24 Jul 2008 10:21:55 +0000 (10:21 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@3066 1a406e8e-add9-4483-a2c8-d8cac5b7c224

src/chxj_cookie.c
src/mod_chxj.c

index 389c750..a09219f 100644 (file)
@@ -459,7 +459,9 @@ chxj_load_cookie(request_rec *r, char *cookie_id)
 
   cookie = (cookie_t*)apr_palloc(r->pool, sizeof(cookie_t));
   cookie->cookie_headers = NULL;
-  cookie->cookie_id = apr_pstrdup(r->pool, cookie_id);
+  cookie->cookie_id = chxj_url_decode(r->pool, apr_pstrdup(r->pool, cookie_id));
+  cookie->cookie_id = chxj_url_encode(r->pool, cookie->cookie_id);
+
 
   dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   entryp = chxj_apply_convrule(r, dconf->convrules);
index 3d08f3d..612a022 100644 (file)
@@ -143,6 +143,7 @@ converter_t convert_routine[] = {
 
 static int chxj_convert_input_header(request_rec *r,chxjconvrule_entry *entryp);
 static void s_add_cookie_id_if_has_location_header(request_rec *r, cookie_t *cookie);
+static void s_clear_cookie_header(request_rec *r, device_table *spec);
 
 /**
  * Only when User-Agent is specified, the User-Agent header is camouflaged. 
@@ -172,6 +173,14 @@ chxj_headers_fixup(request_rec *r)
     DBG(r, "end chxj_headers_fixup()");
     return DECLINED;
   }
+  if (r->method_number == M_POST) {
+    if (!apr_table_get(r->headers_in, "X-Chxj-Forward")) {
+      s_clear_cookie_header(r, spec);
+    }
+  }
+  else {
+    s_clear_cookie_header(r, spec);
+  }
 
   switch(spec->html_spec_type) {
   case CHXJ_SPEC_Chtml_1_0:
@@ -257,6 +266,28 @@ chxj_headers_fixup(request_rec *r)
   return DECLINED;
 }
 
+
+static void
+s_clear_cookie_header(request_rec *r, device_table *spec)
+{
+  switch(spec->html_spec_type) {
+  case CHXJ_SPEC_Chtml_1_0:
+  case CHXJ_SPEC_Chtml_2_0:
+  case CHXJ_SPEC_Chtml_3_0:
+  case CHXJ_SPEC_Chtml_4_0:
+  case CHXJ_SPEC_Chtml_5_0:
+  case CHXJ_SPEC_Chtml_6_0:
+  case CHXJ_SPEC_Chtml_7_0:
+  case CHXJ_SPEC_XHtml_Mobile_1_0:
+  case CHXJ_SPEC_Jhtml:
+    apr_table_unset(r->headers_in, "Cookie");
+    break;
+  default:
+    break;
+  }
+}
+
+
 /**
  * It converts it from CHTML into XXML corresponding to each model. 
  *