Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EFF39104B7 for ; Sun, 2 Feb 2014 23:59:26 +0000 (UTC) Received: (qmail 87792 invoked by uid 500); 2 Feb 2014 23:59:26 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 87700 invoked by uid 500); 2 Feb 2014 23:59:25 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 87692 invoked by uid 99); 2 Feb 2014 23:59:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Feb 2014 23:59:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of kean.johnston@gmail.com designates 74.125.82.173 as permitted sender) Received: from [74.125.82.173] (HELO mail-we0-f173.google.com) (74.125.82.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Feb 2014 23:59:16 +0000 Received: by mail-we0-f173.google.com with SMTP id x55so1527971wes.4 for ; Sun, 02 Feb 2014 15:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=M0+7P2HhyrpFOl2NVfc34F56RcKwym2aSHtNDF1S6Qg=; b=07DJmcLLpElDuXvOtLi8rem9W1KI6TjPnorMFNcFrDXZTLQ51JHB65+5jy4gjQC1YK w6bF/zmt8IYSLyeJq6DecYsXQxDdQIS5alOuudyJ8QZ2RBecR6kG0EGiot6y4bo/v7Hk GYVAe/LgXAu0jmh10nKYIKlVSkA6y9DfMM1ZeKDddwo+CxkvLVxKjAX2+iun04K2BH7P 0KrTo/xJ2VSX8J/NLSTsHwkXi6WbEDxZ9dutwx7ir5hSR9fo5hq4XSWeMHqRORyaGJOe 1+coHV4xie1zCxK5mG2Kbqfyvi17iMBj+WxJTJ6jjBvh27JyiMM0Htl7vBDitsMtDCNT 9g6g== X-Received: by 10.180.79.106 with SMTP id i10mr6576995wix.23.1391385536713; Sun, 02 Feb 2014 15:58:56 -0800 (PST) Received: from [192.168.42.42] (41-133-212-153.dsl.mweb.co.za. [41.133.212.153]) by mx.google.com with ESMTPSA id y13sm39146594wjr.8.2014.02.02.15.58.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Feb 2014 15:58:55 -0800 (PST) Message-ID: <52EEDBB8.5000306@gmail.com> Date: Mon, 03 Feb 2014 01:58:48 +0200 From: Kean Johnston User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: modules-dev@httpd.apache.org Subject: Re: pre_config hook References: <52EDB51D.1030805@gmail.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 2/2/2014 10:53 PM, Nick Kew wrote: > > On 2 Feb 2014, at 03:01, Kean Johnston wrote: > > (this really belongs on modules-dev) Apologies. Moving this reply there. > >> I have a question about the pre_config hook. I have a module that registers for that hook, but the function I specify is never called. > > I expect it is, but � Actually I found out why it wasn't (yet). I was attempting to use a config container using AP_INIT_RAW_ARGS, and with EXEC_ON_READ set, I was being called before pre_config had been run. >> I have a hash table that needs to be initialized before any of my config directives are parsed, and I am getting a SIGSEGV because that is not the case. > > Is the hash table a member of a configuration struct? > I expect it's initialised in the root context, but your config > directives are in some other context. No, it's just a static variable in my module. Everything is limited to the root context. Here's what I am trying to do. The module is for dealing with FastCGI servers, but without any form of process management as things like mod_fcgid do. For lack of a better word I call these "external" FastCGI servers. I wanted things configured thus: Option1 arg1 etc Option2 arg1 arg2 etc StillMoreOptions etc etc My command_rec has, inter alia: AP_INIT_RAW_ARGS(" >> Is it acceptable to initialize that hash table in my register_hooks function instead? > > Yes, if you can deal with the pool management. But you'll probably > run up against exactly the same issue. If I use EXEC_ON_READ, I move that initialization of extfcgi_servers into my register_hooks function, and allocate the hash in the pool that is the only argument to that function. Is that not safe? If I don't use EXEC_ON_READ then the pre_config hook is run just fine before new_ext_server(). Attempting to use a configuration container like I am is proving to be quite tough for a neophyte. With EXEC_ON_READ, I find I can safely use ap_cfg_getline(), and use cmd->config_file as the third argument to that function. However, if I do NOT use EXEC_ON_READ, then cmd->config_file is NULL and ap_cfg_getline() of course coredumps. Ideally I'd like to not use EXEC_ON_READ, but then I have to figure out what to pass as the third argument of ap_cfg_getline(), or find some other function that I can get config lines between ... . An alternative approach is to give up on using a config container at all and just have a normal config directive and use ap_getword_conf(). Something along the lines of how mod_ext_filter does things. I'd prefer not to though, the container approach looks better. Advice greatly appreciated. Sincerely, Kean