OSDN Git Service

* Fixed bug.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 27 Jun 2008 08:40:30 +0000 (08:40 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 27 Jun 2008 08:40:30 +0000 (08:40 +0000)
    - Set-Cookie is not executed at CGI.
      (Reported by R.Komoriya. thanks!)

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_11_0@2747 1a406e8e-add9-4483-a2c8-d8cac5b7c224

ChangeLog
debian/changelog
src/chxj_chtml10.c
src/chxj_cookie.c

index 6c7b1e9..c90612d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@ libapache2-mod-chxj (0.11.4-1) unstable; urgency=low
     - '+' has not been converted into ' '.
     - The bug that was not able to be displayed correctly when a
       double quart was included in value.
+    - Set-Cookie is not executed at CGI.
+      (Reported by R.Komoriya. thanks!)
 
  -- Atsushi Konno <konn@users.sourceforge.jp>  Fri, 27 Jun 2008 16:02:03 +0900
 
index ada92b5..71dad7b 100644 (file)
@@ -4,6 +4,8 @@ libapache2-mod-chxj (0.11.4-1) unstable; urgency=low
     - '+' has not been converted into ' '.
     - The bug that was not able to be displayed correctly when a
       double quart was included in value.
+    - Set-Cookie is not executed at CGI.
+      (Reported by R.Komoriya. thanks!)
 
  -- Atsushi Konno <konn@users.sourceforge.jp>  Fri, 27 Jun 2008 16:02:03 +0900
 
index 825cb54..b1e61fa 100644 (file)
@@ -21,6 +21,7 @@
 #include "chxj_qr_code.h"
 #include "chxj_cookie.h"
 #include "chxj_encoding.h"
+#include "chxj_str_util.h"
 #include "chxj_buffered_write.h"
 
 #define GET_CHTML10(X) ((chtml10_t*)(X))
index e395f16..46bf453 100644 (file)
@@ -96,8 +96,10 @@ cookie_t*
 chxj_save_cookie(request_rec* r)
 {
   int                 ii;
-  apr_array_header_t* headers;
-  apr_table_entry_t*  hentryp;
+  apr_array_header_t  *headers;
+  apr_table_entry_t   *hentryp;
+  apr_array_header_t  *err_headers;
+  apr_table_entry_t   *err_hentryp;
   char                *old_cookie_id;
   char                *store_string;
   mod_chxj_config     *dconf;
@@ -130,11 +132,10 @@ chxj_save_cookie(request_rec* r)
     return NULL;
   }
 
-
-
   headers = (apr_array_header_t*)apr_table_elts(r->headers_out);
   hentryp = (apr_table_entry_t*)headers->elts;
-
+  err_headers = (apr_array_header_t*)apr_table_elts(r->err_headers_out);
+  err_hentryp = (apr_table_entry_t*)err_headers->elts;
 
   new_cookie_table = apr_table_make(r->pool, 0);
 
@@ -155,7 +156,31 @@ chxj_save_cookie(request_rec* r)
         *val++ = 0;
         apr_table_add(new_cookie_table, key, val);
         if (strcasecmp(REFERER_COOKIE_KEY, key) == 0) has_refer++;
-        
+
+      }
+
+      has_cookie = 1;
+      DBG(r, "=====================================");
+    }
+  }
+  for (ii=0; ii<err_headers->nelts; ii++) {
+    if (strcasecmp(err_hentryp[ii].key, "Set-Cookie") == 0) {
+      DBG(r, "=====================================");
+      DBG(r, "cookie=[%s:%s]", err_hentryp[ii].key, err_hentryp[ii].val);
+
+      char* key;
+      char* val;
+      char* buff;
+
+
+      buff = apr_pstrdup(r->pool, err_hentryp[ii].val);
+      val = strchr(buff, '=');
+      if (val) {
+        key = buff;
+        *val++ = 0;
+        apr_table_add(new_cookie_table, key, val);
+        if (strcasecmp(REFERER_COOKIE_KEY, key) == 0) has_refer++;
+
       }
 
       has_cookie = 1;
@@ -163,6 +188,8 @@ chxj_save_cookie(request_rec* r)
     }
   }
   apr_table_unset(r->headers_out, "Set-Cookie");
+  apr_table_unset(r->err_headers_out, "Set-Cookie");
+
 
   if (! has_refer) {
     apr_uri_parse(r->pool,r->uri, &parsed_uri);