apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Ċ mejkal <pavel.smej...@tricube.cz>
Subject apr_hash_get problem
Date Sat, 05 Aug 2006 13:36:11 GMT
Hello, I am trying to improve mod_vhost_dbi module. I added some new 
features like better PHP support and caching with apr_hash. Everything 
works fine but i have little problem with function apr_hash_get. I have 
structure vhost_cache_entry which i created and fill. there is stored 
informations about virtual host. After this i store this structure to 
hash table. In next request is this information retrieved from hash 
table instead of  database. But some times function apr_hash_get returns 
damaged structure with string like "\xf06\xc5" in document_root 
property. I can find any thing wrong in my code. In next request is 
everything ok. Is there somebody which can helps me please.

// CREATE CACHE_ENTRY
cache_entry = (vhost_cache_entry *) apr_pcalloc(r->pool, 
sizeof(vhost_cache_entry));

// GET STRUCTURE
cache_entry = apr_hash_get(vhost_cache, host, APR_HASH_KEY_STRING);


// STORE STRUCTURE
apr_hash_set(vhost_cache, host, APR_HASH_KEY_STRING, cache_entry);


// STRUCTURES
typedef struct
{
    /* Is Vhost Dbi on or off? */
    int status;
    /* IS PHP SafeMod on or off? */
    int safe_mode;
    /* String Identifier of our DBI Connection Pool */
    conn_id id;
    /* SQL Query to use for finding the Virtual Host Information */
    const char *document_root;
    const char *server_name;
    const char *username;
    const char *query;
    const char *append_to_open_base_dir;
} vhost_dbi_config_rec;

typedef struct
{
    const char name;
    vhost_dbi_config_rec rec;
} vhost_cache_entry;



Mime
View raw message