Re: [mp2] APR::Socket::recv set read timeout ?

2002-12-29 Thread Stas Bekman
Michael wrote:


ii) is there any way to perform a select(2) or like on the $socket? I
would like to implement some sort of 'timeout' in the read loop..say,
after 5 secs if nothing is recv'd from the client then the connection
will be closed. I have tried alarm/die pair but it was a failure. Any



idea?


You have the APR::Socket object, so it should be possible. Though I see
that apr_poll_ API is not glued.

!MODULE=APR::Poll
 apr_poll_socket_add
 apr_poll_socket_clear
 apr_poll_data_get
 apr_poll_revents_get
 apr_poll_socket_mask
 apr_poll
 apr_poll_socket_remove
 apr_poll_data_set
 apr_poll_setup

The ! mark in xs/maps/apr_functions.map disables the glueing of this API
subset at the build time.



sorry but I would like to ask how do I glue that?
I tried the util/xs_check.pl in the modperl2 src dir, and it reports..

 unable to glue 27 mapped functions:

[...]

it requires more than that, since the C types used by apr_pool functions 
aren't all having Perl typemap entries. Before we implement these let's 
ask Doug why he chose to skip APR::Poll in first place.

Finally, as I've mention before, I would like to put this non http thing
together with other http things on the same port 80. Is this possible? say,
when this handler sees GET|POST|HEAD it forgets the request and let the
Apache HTTP module process it in the normal way?


This is a job of the PerlPreConnectionHandler, which is currently not 
implemented. Its purpose is to look at the first request of the new 
connection and dynamically assign a protocol handler for the current 
connection.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [mp2] APR::Socket::recv set read timeout ?

2002-12-28 Thread Michael


 Michael wrote:
  Hi all.
 
  As suggested by Geoff and Stas, I am trying out modperl2.. Now I have
  some questions:
 
  i) with Apache::CommandServer (can be found at
 
http://perl.apache.org/docs/2.0/user/overview/overview.html#toc_Protocol_Mod
ules_with_mod_perl_2_0),
  I setup everything according to the guide..but
 
  telnet localhost 8084
 Trying 127.0.0.1...
 Connected to localhost (127.0.0.1).
 Escape character is '^]'.
 
 Login: foo
 Password: foo
 ^]
 
I must hit return once before the 'Login' prompt appears, and after a
  few tests I found that $socket-send() do not send the buffer to the
  client right away. Is this related to some configurable directives in
  httpd.conf or I did something wrong.. or just a feature?

 I'm trying to bring the overview and design notes docs up-to-date, Doug
 wrote them long time ago and things have changed a bit since then. The
 almost up-to-date version of the overview is here:
 http://perl.apache.org/docs/2.0/user/intro/overview.html
 How did you get to the old URL? Via google?

I think I found that link somewhere in the user guide, but I am not sure
anyway.

  ii) is there any way to perform a select(2) or like on the $socket? I
  would like to implement some sort of 'timeout' in the read loop..say,
  after 5 secs if nothing is recv'd from the client then the connection
  will be closed. I have tried alarm/die pair but it was a failure. Any
idea?

 You have the APR::Socket object, so it should be possible. Though I see
 that apr_poll_ API is not glued.

 !MODULE=APR::Poll
   apr_poll_socket_add
   apr_poll_socket_clear
   apr_poll_data_get
   apr_poll_revents_get
   apr_poll_socket_mask
   apr_poll
   apr_poll_socket_remove
   apr_poll_data_set
   apr_poll_setup

 The ! mark in xs/maps/apr_functions.map disables the glueing of this API
 subset at the build time.

sorry but I would like to ask how do I glue that?
I tried the util/xs_check.pl in the modperl2 src dir, and it reports..

 unable to glue 27 mapped functions:
  ap_allow_standard_methods
  ap_register_input_filter
  ap_register_output_filter
  apr_brigade_printf
  apr_brigade_puts
  apr_brigade_write
  apr_getnameinfo
  apr_parse_addr_port
  apr_poll
  apr_poll_revents_get
  apr_poll_setup
  apr_poll_socket_add
  apr_poll_socket_clear
  apr_poll_socket_mask
  apr_poll_socket_remove
  apr_pool_child_cleanup_set
  apr_pool_cleanup_kill
  apr_pool_cleanup_run
  apr_pool_get_abort
  apr_pool_note_subprocess
  apr_pool_userdata_get
  apr_pool_userdata_set
  apr_shutdown
  apr_socket_addr_get
  apr_socket_data_get
  apr_socket_data_set
  apr_socket_from_file


Finally, as I've mention before, I would like to put this non http thing
together with other http things on the same port 80. Is this possible? say,
when this handler sees GET|POST|HEAD it forgets the request and let the
Apache HTTP module process it in the normal way?






[mp2] APR::Socket::recv set read timeout ?

2002-12-27 Thread Michael



Hi all.

As suggested by Geoff and Stas, I am trying out modperl2.. Now Ihave 
somequestions:

i)with Apache::CommandServer(can be found at http://perl.apache.org/docs/2.0/user/overview/overview.html#toc_Protocol_Modules_with_mod_perl_2_0), 
I setup everything according to the guide..but


  telnet localhost 8084
Trying 127.0.0.1... Connected to 
localhost (127.0.0.1). Escape character is '^]'.

 Login: foo
 Password: foo
 ^]

I musthit return once before the 'Login' prompt appears, 
and after a few tests I found that $socket-send() do not send the buffer to 
the client right away. Is this related to some configurable directives in 
httpd.conf or I did something wrong.. or just a feature?

ii) is there any way to perform a select(2) or like on the $socket? I would 
like to implement some sort of 'timeout' in the read loop..say, after 5 secs if 
nothing is recv'd from the client then the connection will be closed. I have 
tried alarm/die pair but it was a failure. Any idea?

Thanks in advance.

Michael



Re: [mp2] APR::Socket::recv set read timeout ?

2002-12-27 Thread Stas Bekman
Michael wrote:

Hi all.
 
As suggested by Geoff and Stas, I am trying out modperl2.. Now I have 
some questions:
 
i) with Apache::CommandServer (can be found at 
http://perl.apache.org/docs/2.0/user/overview/overview.html#toc_Protocol_Modules_with_mod_perl_2_0), 
I setup everything according to the guide..but
 
telnet localhost 8084
   Trying 127.0.0.1...
   Connected to localhost (127.0.0.1).
   Escape character is '^]'.
 
   Login: foo
   Password: foo
   ^]
 
  I must hit return once before the 'Login' prompt appears, and after a 
few tests I found that $socket-send() do not send the buffer to the 
client right away. Is this related to some configurable directives in 
httpd.conf or I did something wrong.. or just a feature?

I'm trying to bring the overview and design notes docs up-to-date, Doug 
wrote them long time ago and things have changed a bit since then. The 
almost up-to-date version of the overview is here:
http://perl.apache.org/docs/2.0/user/intro/overview.html
How did you get to the old URL? Via google?

For the latest docs on protocols see:

http://perl.apache.org/docs/2.0/user/handlers/protocols.html

If based on this doc you can bring the example from the overview 
up-to-date and send a patch here, I'll move it into the protocols doc, 
where it belongs.

ii) is there any way to perform a select(2) or like on the $socket? I 
would like to implement some sort of 'timeout' in the read loop..say, 
after 5 secs if nothing is recv'd from the client then the connection 
will be closed. I have tried alarm/die pair but it was a failure. Any idea?

You have the APR::Socket object, so it should be possible. Though I see 
that apr_poll_ API is not glued.

!MODULE=APR::Poll
 apr_poll_socket_add
 apr_poll_socket_clear
 apr_poll_data_get
 apr_poll_revents_get
 apr_poll_socket_mask
 apr_poll
 apr_poll_socket_remove
 apr_poll_data_set
 apr_poll_setup

The ! mark in xs/maps/apr_functions.map disables the glueing of this API 
subset at the build time.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com