/*----------------------------------------------------------------------------*/
/* Prototype */
/*----------------------------------------------------------------------------*/
-char* chxj_exchange_chtml10( request_rec* r, device_table* spec, const char* src, apr_size_t srclen, apr_size_t *dstlen, chxjconvrule_entry* entryp);
+char* chxj_exchange_chtml10( request_rec* r, device_table* spec, const char* src, apr_size_t srclen, apr_size_t *dstlen, chxjconvrule_entry* entryp, const char* cookie_id);
#endif
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp);
+ chxjconvrule_entry* entryp,
+ const char* cookie_id);
#endif
const char* src,
apr_size_t srclen,
apr_size_t* dstlen,
- chxjconvrule_entry* entryp);
+ chxjconvrule_entry* entryp,
+ const char* cookie_id);
#endif
#include "mod_chxj.h"
-extern void chxj_save_cookie(request_rec *r);
+extern char* chxj_save_cookie(request_rec *r);
#endif
/*
const char* src,
apr_size_t srclen,
apr_size_t* dstlen,
- chxjconvrule_entry* entryp) ;
+ chxjconvrule_entry* entryp,
+ const char* cookie_id);
char* qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len);
char* qs_conv_istyle_to_format(request_rec* r, char* is);
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp) ;
+ chxjconvrule_entry* entryp,
+ const char* cookie_id) ;
#endif
const char* src,
apr_size_t srclen,
apr_size_t* dstlen,
- struct _chxjconvrule_entry* entryp);
+ struct _chxjconvrule_entry* entryp,
+ const char* cookie_id);
char* (*encoder)(request_rec* r,
const char* src,
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp) ;
+ chxjconvrule_entry* entryp,
+ const char* cookie_id) ;
#endif
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
/*
*
*/
-void
+char*
chxj_save_cookie(request_rec* r)
{
int ii;
char* uuid_string;
unsigned char* md5_value;
char* md5_string;
+ mod_chxj_global_config* gconf;
+
DBG(r, "start chxj_save_cookie()");
+ md5_string = NULL;
+
+ gconf = ap_get_module_config(r->server->module_config, &chxj_module);
headers = (apr_array_header_t*)apr_table_elts(r->headers_out);
entryp = (apr_table_entry_t*)headers->elts;
- retval = apr_dbm_open_ex(&f,
- "default",
- "/tmp/cookie.db",
- APR_DBM_RWCREATE,
- APR_OS_DEFAULT,
- r->pool);
- if (retval != APR_SUCCESS) {
- ERR2(r, "could not open dbm (type %s) auth file: %s", "default", "/tmp/cookie.db");
- return;
- }
cookie = apr_palloc(r->pool, 1);
cookie[0] = 0;
DBG(r, "=====================================");
}
}
+
+ if (strlen(cookie) == 0) {
+ DBG(r, "no cookie");
+ return NULL;
+ }
+
+ apr_global_mutex_lock(gconf->cookie_db_lock);
+
+ retval = apr_dbm_open_ex(&f,
+ "default",
+ "/tmp/cookie.db",
+ APR_DBM_RWCREATE,
+ APR_OS_DEFAULT,
+ r->pool);
+ if (retval != APR_SUCCESS) {
+ ERR2(r, "could not open dbm (type %s) auth file: %s", "default", "/tmp/cookie.db");
+ apr_global_mutex_unlock(gconf->cookie_db_lock);
+ return NULL;
+ }
+
apr_uuid_get(&uuid);
uuid_string = apr_palloc(r->pool, APR_UUID_FORMATTED_LENGTH + 1);
memset(uuid_string, 0, APR_UUID_FORMATTED_LENGTH + 1);
on_error:
apr_dbm_close(f);
+ apr_global_mutex_unlock(gconf->cookie_db_lock);
DBG(r, "end chxj_save_cookie()");
+ return md5_string;
}
/*
* @return The character string after the converting is returned.
*/
char*
-chxj_exchange_hdml(request_rec* r,
- device_table* spec,
- const char* src,
- apr_size_t srclen,
- apr_size_t* dstlen,
- chxjconvrule_entry* entryp
+chxj_exchange_hdml(
+ request_rec* r,
+ device_table* spec,
+ const char* src,
+ apr_size_t srclen,
+ apr_size_t* dstlen,
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
const char* src,
apr_size_t srclen,
apr_size_t *dstlen,
- chxjconvrule_entry* entryp
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
const char* src,
apr_size_t srclen,
apr_size_t* dstlen,
- chxjconvrule_entry* entryp
+ chxjconvrule_entry* entryp,
+ const char* cookie_id
)
{
char* dst = NULL;
char* user_agent;
char* dst;
char* tmp;
+ char* cookie_id;
mod_chxj_config* dconf;
chxjconvrule_entry* entryp;
/*
* save cookie.
*/
- chxj_save_cookie(r);
+ cookie_id = chxj_save_cookie(r);
if (!r->header_only) {
device_table* spec = chxj_specified_device(r, user_agent);
if (convert_routine[spec->html_spec_type].converter) {
if (tmp)
- dst = convert_routine[spec->html_spec_type].converter(r, spec, tmp, *len, len, entryp);
+ dst = convert_routine[spec->html_spec_type].converter(r,
+ spec,
+ tmp,
+ *len,
+ len,
+ entryp,
+ cookie_id);
else
- dst = convert_routine[spec->html_spec_type].converter(r, spec, *src, *len, len, entryp);
+ dst = convert_routine[spec->html_spec_type].converter(r,
+ spec,
+ tmp,
+ *len,
+ len,
+ entryp,
+ cookie_id);
}
}
return APR_SUCCESS;
}
-/**
- * It is processing when the module ends. The shared memory etc. are liberated.
- *
- * @param data [i] The pointer to the server_rec structure is specified.
- * @return APR_SUCCESS
- *
- */
-apr_status_t
-chxj_init_module_kill(void *data)
-{
- server_rec *base_server = (server_rec *)data;
- mod_chxj_global_config* conf;
-
- /*--------------------------------------------------------------------------*/
- /* The setting of each server is acquired. */
- /*--------------------------------------------------------------------------*/
- if (base_server)
- conf = ap_get_module_config(base_server->module_config, &chxj_module);
-
- return APR_SUCCESS;
-}
-
static mod_chxj_global_config*
chxj_global_config_create(apr_pool_t* pool, server_rec* s)
#include "http_log.h"
-extern apr_status_t chxj_init_module_kill(void *data);
void
qs_log(Doc* doc, int log_level,const char* f, int l, char* msg)
#endif
if (doc->r) {
ap_log_rerror(f,l, APLOG_CRIT, 0, doc->r, msg);
- chxj_init_module_kill((void*)doc->r->server);
}
qs_all_free(doc, QX_LOGMARK);
_exit(0);