stas 2002/08/15 01:42:55 Modified: xs/Apache/Connection Apache__Connection.h xs/maps modperl_functions.map apache_functions.map xs/tables/current/ModPerl FunctionTable.pm t/response/TestAPI conn_rec.pm Log: add a wrapper for ap_get_remote_host + tests Revision Changes Path 1.4 +8 -0 modperl-2.0/xs/Apache/Connection/Apache__Connection.h Index: Apache__Connection.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/Connection/Apache__Connection.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Apache__Connection.h 30 Jan 2002 03:30:24 -0000 1.3 +++ Apache__Connection.h 15 Aug 2002 08:42:55 -0000 1.4 @@ -11,3 +11,11 @@ return socket; } + +static MP_INLINE +char *mpxs_Apache__Connection_get_remote_host(pTHX_ conn_rec *c, + int type, + apr_table_t *dir_config) +{ + return ap_get_remote_host(c, (void *)dir_config, type, NULL); +} 1.40 +2 -0 modperl-2.0/xs/maps/modperl_functions.map Index: modperl_functions.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- modperl_functions.map 21 May 2002 02:50:16 -0000 1.39 +++ modperl_functions.map 15 Aug 2002 08:42:55 -0000 1.40 @@ -64,6 +64,8 @@ MODULE=Apache::Connection mpxs_Apache__Connection_client_socket | | c, s=NULL + mpxs_Apache__Connection_get_remote_host | | c, type=REMOTE_NAME, dir_config=Nullsv + MODULE=Apache::Filter modperl_filter_attributes | MPXS_ | ... | MODIFY_CODE_ATTRIBUTES 1.56 +0 -1 modperl-2.0/xs/maps/apache_functions.map Index: apache_functions.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- apache_functions.map 24 May 2002 17:37:08 -0000 1.55 +++ apache_functions.map 15 Aug 2002 08:42:55 -0000 1.56 @@ -170,7 +170,6 @@ ap_server_root_relative | mpxs_ | SV *:p, fname="" MODULE=Apache::Connection PACKAGE=guess - ap_get_remote_host #XXX: thought this might be useful for protocol modules #however it is not exported on win32 !ap_read_request 1.76 +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.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- FunctionTable.pm 23 Jun 2002 21:28:15 -0000 1.75 +++ FunctionTable.pm 15 Aug 2002 08:42:55 -0000 1.76 @@ -4305,6 +4305,28 @@ ] }, { + 'return_type' => 'char *', + 'name' => 'mpxs_Apache__Connection_get_remote_host', + 'args' => [ + { + 'type' => 'PerlInterpreter *', + 'name' => 'my_perl' + }, + { + 'type' => 'conn_rec *', + 'name' => 'c' + }, + { + 'type' => 'int', + 'name' => 'type' + }, + { + 'type' => 'apr_table_t *', + 'name' => 'dir_config' + } + ] + }, + { 'return_type' => 'apr_size_t', 'name' => 'mpxs_Apache__Filter_print', 'attr' => [ 1.6 +18 -2 modperl-2.0/t/response/TestAPI/conn_rec.pm Index: conn_rec.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/conn_rec.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- conn_rec.pm 11 Apr 2002 11:08:43 -0000 1.5 +++ conn_rec.pm 15 Aug 2002 08:42:55 -0000 1.6 @@ -3,13 +3,15 @@ use strict; use warnings FATAL => 'all'; +use Apache::TestUtil; use Apache::Test; use Apache::RequestRec (); use Apache::RequestUtil (); use Apache::Connection (); -use Apache::Const -compile => 'OK'; +use Apache::Const -compile => qw(OK REMOTE_HOST REMOTE_NAME + REMOTE_NOLOOKUP REMOTE_DOUBLE_REV); #this test module is only for testing fields in the conn_rec #listed in apache_structures.map @@ -19,7 +21,7 @@ my $c = $r->connection; - plan $r, tests => 15; + plan $r, tests => 22; ok $c; @@ -56,6 +58,20 @@ #input_filters #output_filters #remain + + # Connection utils (XXX: move to conn_utils.pm?) + + # $c->get_remote_host + ok $c->get_remote_host() || 1; + + for (Apache::REMOTE_HOST, Apache::REMOTE_NAME, + Apache::REMOTE_NOLOOKUP, Apache::REMOTE_DOUBLE_REV) { + ok $c->get_remote_host($_) || 1; + } + + ok $c->get_remote_host(Apache::REMOTE_HOST, + $c->base_server->dir_config) || 1; + ok $c->get_remote_host(Apache::REMOTE_HOST, $r->dir_config) || 1; Apache::OK; }