From: konn Date: Fri, 27 Jun 2008 08:40:30 +0000 (+0000) Subject: * Fixed bug. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=36ad3493f9d36e4141ea85e8c90fd9774e70b3fe;p=modchxj%2Fmod_chxj.git * Fixed bug. - 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 --- diff --git a/ChangeLog b/ChangeLog index 6c7b1e9e..c90612db 100644 --- 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 Fri, 27 Jun 2008 16:02:03 +0900 diff --git a/debian/changelog b/debian/changelog index ada92b5f..71dad7bc 100644 --- a/debian/changelog +++ b/debian/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 Fri, 27 Jun 2008 16:02:03 +0900 diff --git a/src/chxj_chtml10.c b/src/chxj_chtml10.c index 825cb54a..b1e61fa0 100644 --- a/src/chxj_chtml10.c +++ b/src/chxj_chtml10.c @@ -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)) diff --git a/src/chxj_cookie.c b/src/chxj_cookie.c index e395f164..46bf4536 100644 --- a/src/chxj_cookie.c +++ b/src/chxj_cookie.c @@ -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; iinelts; 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);