From dev-return-17019-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Sat Aug 05 13:36:35 2006 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 75768 invoked from network); 5 Aug 2006 13:36:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2006 13:36:34 -0000 Received: (qmail 66569 invoked by uid 500); 5 Aug 2006 13:36:33 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 66524 invoked by uid 500); 5 Aug 2006 13:36:33 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 66513 invoked by uid 99); 5 Aug 2006 13:36:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Aug 2006 06:36:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [82.208.56.65] (HELO orbiter.cz) (82.208.56.65) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Aug 2006 06:36:33 -0700 Received: from localhost (orbiter.cz [127.0.0.1]) by orbiter.cz (Postfix) with ESMTP id 17134A01E7 for ; Sat, 5 Aug 2006 15:36:12 +0200 (CEST) Received: from orbiter.cz ([127.0.0.1]) by localhost (orbiter.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02436-10 for ; Sat, 5 Aug 2006 15:36:08 +0200 (CEST) Received: from [192.168.0.180] (unknown [213.29.14.70]) by orbiter.cz (Postfix) with ESMTP id 9998AA01E6 for ; Sat, 5 Aug 2006 15:36:07 +0200 (CEST) Message-ID: <44D49ECB.5020309@tricube.cz> Date: Sat, 05 Aug 2006 15:36:11 +0200 From: =?ISO-8859-2?Q?Pavel_=A9mejkal?= User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: dev@apr.apache.org Subject: apr_hash_get problem Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at orbiter.cz X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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;