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 AD44D9872 for ; Tue, 5 Jun 2012 07:30:41 +0000 (UTC) Received: (qmail 96011 invoked by uid 500); 5 Jun 2012 07:30:41 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 95689 invoked by uid 500); 5 Jun 2012 07:30:39 -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 95636 invoked by uid 99); 5 Jun 2012 07:30:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 07:30:37 +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 sorinm@gmail.com designates 209.85.215.173 as permitted sender) Received: from [209.85.215.173] (HELO mail-ey0-f173.google.com) (209.85.215.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 07:30:27 +0000 Received: by eaak12 with SMTP id k12so2312643eaa.18 for ; Tue, 05 Jun 2012 00:30:07 -0700 (PDT) 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=AzbXLqd9cJJTRGDxPfSqphG8zcGKrrBSbTMnxBq88ko=; b=mh809HP1fpzGmffPtN4pZAKfv8QaPublL2/zSys4YXty2ZsWv2BEC2IvjIq1Sc2S9o LGYJVAMVFpkc4QMsYwRWNHhFOYdMIwpQGO/rRY6jrz1PB5oSxbZ413ZEICgejyueFI9q q5lHoM4lyVAWMon4jWA8nmWO9io+y1wBz8z9SElwiPXUVBUR8pZMfkrXgb6QvTepWbpW NLbiZCt2CtV9pgbTp2ifpE5iKFHbJ/GeGtnyrInWjbdH6Icf7RSHDJEjICFELreFKAuR ZXk+xfMH1M8C5Eikp4Xsv2CW0NRFOPzreFzynpKefrDmAVk4ZV1GSo2tHaqXVFD0Rj+e dYhg== Received: by 10.14.98.68 with SMTP id u44mr6892851eef.85.1338881407037; Tue, 05 Jun 2012 00:30:07 -0700 (PDT) Received: from [192.168.2.204] (ant06-1-82-242-109-184.fbx.proxad.net. [82.242.109.184]) by mx.google.com with ESMTPS id o16sm2730389eeb.13.2012.06.05.00.30.05 (version=SSLv3 cipher=OTHER); Tue, 05 Jun 2012 00:30:06 -0700 (PDT) Message-ID: <4FCDB577.2080706@gmail.com> Date: Tue, 05 Jun 2012 09:29:59 +0200 From: Sorin Manolache User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: modules-dev@httpd.apache.org Subject: Re: Protocol converter module References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-06-04 18:40, Robert Mitschke wrote: > Hi everybody, > > I am attempting to write a module that implements a binary protocol that is > not http and is not fully request and response based using apache. I have > looked at mode echo and some others and I have Nick Kew's book. > > I want my module to convert incoming messages into http requests so that > Apache is going to serve them using normal application server > infrastructure. This is what I, based on the info I have can easily do > using an input and output filter. > > What I also need the protocol to be able to do is to send messages to the > client with no incoming data from the client. This may be based on a > timeout or based on a request coming from somewhere else (a tier-2 > application server sending me a request on a totally different connection). > >> From what I have read so far, I could not find a hook that allows me to do > so. The only way that I could figure out how to do that is to modify > http_core.c and in ap_process_http_sync_connection query for either the > timeout or the separate even to have occured using some shared memory > technique. This however does not feel right to me. I would ideally like to > keep using http_core as it is without touching it. > > Is there a way for me to wake up trigger the input filter chain even when > there is no data on the actual connection? I could then create a request > from the context of my persistent connection for a handler that I have > written that triggers the output filter chain to send the correct message. > Or even better is there a way I can trigger the output filter chain? Are > there hooks for this purpose? > > I would very much appreciate a hint in the right direction. > Hello, As your protocol is not http, I think that you should not execute ap_process_http_*_connection. ap_process_http_*_connection is a callback placed on the process_connection hook. I would suggest that you place your own protocol-specific callback on the process_connection hook. In your callback you get the socket descriptor and you perform "select" syscalls with timeout on the descriptor in a loop to get the timeout behaviour. If you want to push data upon an incoming http request from a third-party, I think you cannot avoid the shared memory approach. The process that handles your http request has somehow to communicate with the process in which you handle the non-http connection to your client. I've written something similar for SMPP and I remember I considered the filter implementation alternative but ultimately I did it without filters. Sorin > Best regards, > Robert >