Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 68285 invoked from network); 18 Aug 2010 12:25:31 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Aug 2010 12:25:31 -0000 Received: (qmail 28366 invoked by uid 500); 18 Aug 2010 12:25:31 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 28050 invoked by uid 500); 18 Aug 2010 12:25:28 -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 28042 invoked by uid 99); 18 Aug 2010 12:25:27 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Aug 2010 12:25:27 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of martin.townsend@power-oasis.com designates 83.223.107.180 as permitted sender) Received: from [83.223.107.180] (HELO geode.123-dns.net) (83.223.107.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Aug 2010 12:25:01 +0000 Received: from host81-134-69-66.in-addr.btopenworld.com ([81.134.69.66] helo=[192.168.1.70]) by geode.123-dns.net with esmtpa (Exim 4.69) (envelope-from ) id 1OlhhA-0008Gn-ND for modules-dev@httpd.apache.org; Wed, 18 Aug 2010 13:24:41 +0100 Message-ID: <4C6BD107.8090105@power-oasis.com> Date: Wed, 18 Aug 2010 13:24:39 +0100 From: Martin Townsend Organization: Power Oasis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: modules-dev@httpd.apache.org Subject: Problem with ap_internal_redirect_handler References: <1282127844.85602.ezmlm@httpd.apache.org> <4C6BD095.3000508@power-oasis.com> In-Reply-To: <4C6BD095.3000508@power-oasis.com> Content-Type: multipart/alternative; boundary="------------080407050905030408080403" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - geode.123-dns.net X-AntiAbuse: Original Domain - httpd.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - power-oasis.com X-Virus-Checked: Checked by ClamAV on apache.org --------------080407050905030408080403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm currently trying to add the ability to redirect requests for the initial html page to a captcha page when there is no session or no valid session. Currently I'm doing this in the fixups hook: mod_smu_fixups(request_rec* r) { const char * content_type_str_p; const char * content_len_str_p; /* Get the modules config vector. */ MOD_SMU_SERVER_CFG_T * const smu_svr_cfg_p = ap_get_module_config( r->server->module_config, &smu_module); if(DEBUG_ENABLED & DEBUG_SMU) { ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "SMU Module Fixups %s (%s)", r->method, r->filename); ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "SMU Module Fixups init-req(%d) handler(%s) content-type(%s)", ap_is_initial_req(r), r->handler, r->content_type); } /* * If we are being requested for the captcha image then send this request * to the smu-captcha content generator which will generate it on the fly. */ if(smu_captcha_is_image_request(r)) { ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "SMU Fixup CAPTCHA Image (%s)", r->filename); r->handler = "application/smu-captcha"; return OK; } /* If this is the initial request (ie not a sub request) clear the error * and command list */ if(ap_is_initial_req(r)) { /* First up ensure that the error and command list are empty */ mod_smu_list_empty(smu_svr_cfg_p->command_list_p); /* Empty error list */ mod_smu_list_empty(smu_svr_cfg_p->error_list_p); /* Check to see if a captcha page is needed. */ if(captcha_display_needed(r) && apr_strnatcasecmp(r->content_type, "text/html") == 0 ) { //r->handler = "application/smu_captcha"; //ap_internal_redirect("/captcha.shtml", r); ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "SMU Fixup CAPTCHA needed (%s)", r->filename); ap_internal_redirect_handler("/captcha.shtml", r); return OK; } } .... } So if we have an initial request that is HTML then redirect to captcha.shtml which contains SSI for header, footer etc. There will also be a request for a captcha image using a fixed filename. The fixup will detect this and send the request to a custom handler that will auto-generate the captcha image. The problem I have is that I'm getting sub-requests and requests for the captcha image twice, see log below. I assume that the original request for index.shtml and the request for captcha.shtml are being processed. Using firebug I see that the captcha image that is displayed in the debug output isn't the one that gets displayed in the HTML so I can assume that the image is being sent twice. I notice that the browser goes into a waiting state until the timeout expires. Does anybody know what I'm doing wrong? I've tried returning DECLINED or DONE after the ap_internal_redirect_handler call but still get the problem. Any help appreciated. Best Regards, Martin. [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Fixup CAPTCHA needed (/var/www/index.shtml), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/captcha.shtml), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageHead.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageTop.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_Contents.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageFooter.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageHead.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageTop.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_Contents.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/include/SSI_PageFooter.html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(0) handler((null)) content-type(text/html), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/sscd.css), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(1) handler((null)) content-type(text/css), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/captcha_image.gif), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(1) handler((null)) content-type(image/gif), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] SMU Fixup CAPTCHA Image (/var/www/captcha_image.gif), referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:41 2010] [notice] [client 192.168.1.70] smu-captcha /var/www/captcha_image.gif, referer: http://192.168.0.52/index.shtml [Wed Aug 18 12:39:44 2010] [notice] [client 192.168.1.70] SMU Module Fixups GET (/var/www/captcha_image.gif) [Wed Aug 18 12:39:44 2010] [notice] [client 192.168.1.70] SMU Module Fixups init-req(1) handler((null)) content-type(image/gif) [Wed Aug 18 12:39:44 2010] [notice] [client 192.168.1.70] SMU Fixup CAPTCHA Image (/var/www/captcha_image.gif) [Wed Aug 18 12:39:44 2010] [notice] [client 192.168.1.70] smu-captcha /var/www/captcha_image.gif --------------080407050905030408080403--