You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tyler MacDonald <ty...@yi.org> on 2006/04/17 23:38:31 UTC

Protocol handlers: Change in connection processing from 2.0 to 2.2?

Hi all,

	I have a protocol handler that worked perfectly in apache 2.0.53,
but after upgrading to 2.2, something strange is happening. The protocol
handler processed gnudip2 TCP update requests for yi.org dynamic DNS.

	The GnuDIP2 protocol requires that a password "salt" be sent by the
server as soon as a connection is established. That was how it worked under
apache 2.0. However, it looks like the apache 2.2 server is waiting for a
line of input *before* it processes my connection. Once a line of input is
received from the client, my handler runs, prints its greeting message
(which should have printed right away) and reads the line of input.

	I've tried bumping the priority of my handler from APR_HOOK_MIDDLE
to APR_HOOK_FIRST, but that didn't do any good.

	Has anything changed in connection processing between apache 2.0 and
2.2 that I need to watch out for?

	Here's the line that registers the hook:

 ap_hook_process_connection(ap_process_gnudip2_connection,NULL,NULL, APR_HOOK_FIRST);

	(that was APR_HOOK_MIDDLE before, no difference)

	And here's the line that actually sends the text:

 ap_fprintf(conn->output_filters, tmp_bb, "%s\n", gnudip2_salt);

	I've attached mod_weedns.c and gnudip2_tcp.c from the source. Can
anybody help me solve this?

	Cheers,
		Tyler


Re: Protocol handlers: Change in connection processing from 2.0 to 2.2?

Posted by Tyler MacDonald <ty...@yi.org>.
Paul Querna <ch...@force-elite.com> wrote:
> Nope, mostly because with how the current API is structured, we don't 
> know what module will handle the protocol until runtime.  It could be 
> one that wants Accept Filtering, or one that doesn't.
> 
> If you could with 100% accuracy match a single Listener Record to a 
> Single Protocol Module, then an API could be created to better handle 
> this situation.

How about meeting you halfway: The "Listen" directive still needs a protocol
tag, that makes sense, and IMHO it actually reduces the need for comments in
the config file because when you look at the Listen directive you can tell
right away what it's there for. So say I did

Listen	*:6669 bt_peer

Is there (or should there be) a way to hook in to do the equivalent of
"AcceptFilter bt_peer none" from C, after the configuration file has been
parsed?

	Thanks,
		Tyler


Re: Protocol handlers: Change in connection processing from 2.0 to 2.2?

Posted by Paul Querna <ch...@force-elite.com>.
Tyler MacDonald wrote:
> Paul Querna <ch...@force-elite.com> wrote:
>> Add/Change your configuration to the Following:
>>
>> Listen 1234 GnuDIP2
>> AcceptFilter GnuDIP2 none
>>
>> This will disable the Accept Filter that by default waits for data.
>>
>> See also the docs:
>> http://httpd.apache.org/docs/2.2/mod/core.html#acceptfilter
>> http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen
> 
> 	That works, thanks!!!
> 
> 	This is a private module so I'm not concerned about complicating the
> configuration file, but I'm planning a release of a public module (mod_bt;
> http://www.crackerjack.net/mod_bt/) that will have a protocol handler soon.
> I'll make sure I document that they need to set that option, but...
> 
> 	Is there any way for a module to turn off the AcceptFilter itself?

Nope, mostly because with how the current API is structured, we don't 
know what module will handle the protocol until runtime.  It could be 
one that wants Accept Filtering, or one that doesn't.

If you could with 100% accuracy match a single Listener Record to a 
Single Protocol Module, then an API could be created to better handle 
this situation.

-Paul

Re: Protocol handlers: Change in connection processing from 2.0 to 2.2?

Posted by Tyler MacDonald <ty...@yi.org>.
Paul Querna <ch...@force-elite.com> wrote:
> Add/Change your configuration to the Following:
> 
> Listen 1234 GnuDIP2
> AcceptFilter GnuDIP2 none
> 
> This will disable the Accept Filter that by default waits for data.
> 
> See also the docs:
> http://httpd.apache.org/docs/2.2/mod/core.html#acceptfilter
> http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen

	That works, thanks!!!

	This is a private module so I'm not concerned about complicating the
configuration file, but I'm planning a release of a public module (mod_bt;
http://www.crackerjack.net/mod_bt/) that will have a protocol handler soon.
I'll make sure I document that they need to set that option, but...

	Is there any way for a module to turn off the AcceptFilter itself?

	Thanks,
		Tyler


Re: Protocol handlers: Change in connection processing from 2.0 to 2.2?

Posted by Paul Querna <ch...@force-elite.com>.
Tyler MacDonald wrote:
> Hi all,
> 
> 	I have a protocol handler that worked perfectly in apache 2.0.53,
> but after upgrading to 2.2, something strange is happening. The protocol
> handler processed gnudip2 TCP update requests for yi.org dynamic DNS.
> 
> 	The GnuDIP2 protocol requires that a password "salt" be sent by the
> server as soon as a connection is established. That was how it worked under
> apache 2.0. However, it looks like the apache 2.2 server is waiting for a
> line of input *before* it processes my connection. Once a line of input is
> received from the client, my handler runs, prints its greeting message
> (which should have printed right away) and reads the line of input.

Add/Change your configuration to the Following:

Listen 1234 GnuDIP2
AcceptFilter GnuDIP2 none

This will disable the Accept Filter that by default waits for data.

See also the docs:
http://httpd.apache.org/docs/2.2/mod/core.html#acceptfilter
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen

-Paul