perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0 Changes
Date Tue, 15 Apr 2003 08:39:52 GMT
stas        2003/04/15 01:39:52

  Modified:    src/modules/perl modperl_apache_includes.h
               xs/APR/Socket APR__Socket.h
               xs/maps  apr_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
               .        Changes
  Added:       t/apr    socket.t
               t/response/TestAPR socket.pm
  Log:
  add Perl glue for functions: APR::Socket::timeout_get
  APR::Socket::timeout_set
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/apr/socket.t
  
  Index: socket.t
  ===================================================================
  # WARNING: this file is generated, do not edit
  # 01: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfig.pm:724
  # 02: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfig.pm:741
  # 03: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:102
  # 04: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:491
  # 05: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfig.pm:421
  # 06: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfig.pm:436
  # 07: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestConfig.pm:1243
  # 08: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestRun.pm:405
  # 09: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestRunPerl.pm:39
  # 10: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestRun.pm:582
  # 11: /home/stas/apache.org/mp-socket/t/../Apache-Test/lib/Apache/TestRun.pm:582
  # 12: t/TEST:19
  
  use Apache::TestRequest 'GET';
  my $res = GET "/TestAPR::socket";
  if ($res->is_success) {
      print $res->content;
  }
  else {
      die "server side has failed (response code: ", $res->code, "),\n",
          "see t/logs/error_log for more details\n";
  }
  
  
  
  1.1                  modperl-2.0/t/response/TestAPR/socket.pm
  
  Index: socket.pm
  ===================================================================
  package TestAPR::socket;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::RequestRec ();
  use Apache::Connection ();
  use APR::Socket ();
  
  use Apache::Const -compile => 'OK';
  use APR::Const -compile => 'EMISMATCH';
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 3;
  
      my $c = $r->connection;
      my $socket = $c->client_socket;
  
      # in microseconds
      my $orig_val = $socket->timeout_get();
      t_debug "orig timeout was: $orig_val";
      ok $orig_val;
  
      my $new_val = 30_000_000; # 30 secs
      $socket->timeout_set($new_val);
      ok t_cmp($new_val, $socket->timeout_get(), "timeout_get()");
  
      # reset the timeout
      $socket->timeout_set($orig_val);
      ok t_cmp($orig_val, $socket->timeout_get(), "timeout_get()");
  
      Apache::OK;
  }
  
  1;
  
  
  
  1.22      +28 -3     modperl-2.0/src/modules/perl/modperl_apache_includes.h
  
  Index: modperl_apache_includes.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_apache_includes.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- modperl_apache_includes.h	15 Apr 2003 03:54:13 -0000	1.21
  +++ modperl_apache_includes.h	15 Apr 2003 08:39:52 -0000	1.22
  @@ -32,6 +32,9 @@
   #include "apr_uri.h"
   #include "apr_date.h"
   #include "apr_buckets.h"
  +#include "apr_time.h"
  +#include "apr_network_io.h"
  +
   #include "util_filter.h"
   
   #include "util_script.h"
  @@ -54,11 +57,33 @@
   #define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
   #endif 
   
  -#ifndef apr_socket_opt_get 
  +
  +/* pre-APR_0_9_0 (APACHE_2_0_40) */
  +#if APR_MAJOR_VERSION == 0 && APR_MINOR_VERSION == 9 && \
  +    APR_PATCH_VERSION == 0 && defined(APR_IS_DEV_VERSION)
  +
  +/* deprecated since APR_0_9_0 */
   #define apr_socket_opt_get apr_getsocketopt
  -#endif
  -#ifndef apr_socket_opt_set
   #define apr_socket_opt_set apr_setsocketopt
  +
  +#define modperl_apr_func_not_implemented(func, ver) \
  +    { \
  +        dTHX; \
  +        Perl_croak(aTHX_ #func "() requires APR version " #ver " or higher"); \
  +    }
  +
  +/* added in APACHE_2_0_40/APR_0_9_0 */
  +apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
  +{
  +    modperl_apr_func_not_implemented(timeout_get, 0.9.0);
  +    return APR_ENOTIMPL;
  +}
  +apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
  +{
  +    modperl_apr_func_not_implemented(timeout_set, 0.9.0);
  +    return APR_ENOTIMPL;
  +}
  +
   #endif
   
   #endif /* MODPERL_APACHE_INCLUDES_H */
  
  
  
  1.2       +15 -0     modperl-2.0/xs/APR/Socket/APR__Socket.h
  
  Index: APR__Socket.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/APR/Socket/APR__Socket.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- APR__Socket.h	13 Mar 2001 05:25:11 -0000	1.1
  +++ APR__Socket.h	15 Apr 2003 08:39:52 -0000	1.2
  @@ -34,3 +34,18 @@
   
       return status;
   }
  +
  +static MP_INLINE apr_interval_time_t
  +mpxs_apr_socket_timeout_get(pTHX_ I32 items, SV **MARK, SV **SP)
  +{
  +    apr_interval_time_t	t;
  +    APR__Socket APR__Socket;
  +
  +    /* this also magically assings to APR_Socket ;-) */
  +    mpxs_usage_va_1(APR__Socket, "$socket->timeout_get()");
  +
  +    MP_FAILURE_CROAK(apr_socket_timeout_get(APR__Socket, &t));
  +
  +    return t;
  +}
  +
  
  
  
  1.52      +2 -0      modperl-2.0/xs/maps/apr_functions.map
  
  Index: apr_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apr_functions.map,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- apr_functions.map	15 Apr 2003 03:54:13 -0000	1.51
  +++ apr_functions.map	15 Apr 2003 08:39:52 -0000	1.52
  @@ -62,6 +62,8 @@
   !apr_socket_data_set
    apr_socket_opt_get
    apr_socket_opt_set
  + apr_socket_timeout_get | mpxs_ | ...
  + apr_socket_timeout_set
   -apr_sendfile
   -apr_sendv
   !apr_socket_from_file
  
  
  
  1.111     +22 -0     modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- FunctionTable.pm	1 Apr 2003 05:20:50 -0000	1.110
  +++ FunctionTable.pm	15 Apr 2003 08:39:52 -0000	1.111
  @@ -6341,6 +6341,28 @@
       ]
     },
     {
  +    'return_type' => 'apr_interval_time_t',
  +    'name' => 'mpxs_apr_socket_timeout_get',
  +    'attr' => [
  +      'static',
  +      '__inline__'
  +    ],
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'SV **',
  +        'name' => 'mark'
  +      },
  +      {
  +        'type' => 'SV **',
  +        'name' => 'sp'
  +      }
  +    ]
  +  },
  +  {
       'return_type' => '',
       'name' => 'mpxs_apr_sockaddr_ip_get',
       'args' => [
  
  
  
  1.172     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -r1.171 -r1.172
  --- Changes	14 Apr 2003 23:36:55 -0000	1.171
  +++ Changes	15 Apr 2003 08:39:52 -0000	1.172
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +add Perl glue for functions: APR::Socket::timeout_get
  +APR::Socket::timeout_set [Stas]
  +
   similar to SetEnv, upcase the env keys for PassEnv on platforms with
   caseless env (e.g. win32) [steve.sparling@ps.ge.com]
   
  
  
  

Mime
View raw message