dougm 01/05/22 13:58:21 Modified: src/modules/perl modperl_apache_includes.h modperl_types.h modperl_util.c modperl_util.h t/response/TestAPI rutil.pm uri.pm xs/Apache/URI Apache__URI.h xs/maps apache_functions.map apache_structures.map apache_types.map apr_functions.map apr_structures.map apr_types.map Added: xs/APR/URI APR__URI.h Log: adjust to uri_components apr-ization Revision Changes Path 1.6 +1 -1 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- modperl_apache_includes.h 2001/05/08 18:55:44 1.5 +++ modperl_apache_includes.h 2001/05/22 20:57:27 1.6 @@ -20,7 +20,7 @@ #include "apr_lock.h" #include "apr_strings.h" - +#include "apr_uri.h" #include "apr_buckets.h" #include "util_filter.h" 1.43 +7 -0 modperl-2.0/src/modules/perl/modperl_types.h Index: modperl_types.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- modperl_types.h 2001/05/14 21:22:32 1.42 +++ modperl_types.h 2001/05/22 20:57:30 1.43 @@ -218,4 +218,11 @@ void *data; } modperl_cleanup_data_t; +/* subclass apr_uri_components */ +typedef struct { + apr_uri_components uri; + apr_pool_t *pool; + char *path_info; +} modperl_uri_t; + #endif /* MODPERL_TYPES_H */ 1.15 +8 -0 modperl-2.0/src/modules/perl/modperl_util.c Index: modperl_util.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- modperl_util.c 2001/05/04 06:20:36 1.14 +++ modperl_util.c 2001/05/22 20:57:33 1.15 @@ -316,3 +316,11 @@ cdata->data = data; return cdata; } + +MP_INLINE modperl_uri_t *modperl_uri_new(apr_pool_t *p) +{ + modperl_uri_t *uri = (modperl_uri_t *)apr_pcalloc(p, sizeof(*uri)); + uri->pool = p; + return uri; +} + 1.15 +2 -0 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- modperl_util.h 2001/05/04 06:20:36 1.14 +++ modperl_util.h 2001/05/22 20:57:34 1.15 @@ -47,4 +47,6 @@ modperl_cleanup_data_t *modperl_cleanup_data_new(apr_pool_t *p, void *data); +MP_INLINE modperl_uri_t *modperl_uri_new(apr_pool_t *p); + #endif /* MODPERL_UTIL_H */ 1.2 +5 -2 modperl-2.0/t/response/TestAPI/rutil.pm Index: rutil.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/rutil.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- rutil.pm 2001/05/05 01:02:10 1.1 +++ rutil.pm 2001/05/22 20:57:44 1.2 @@ -3,6 +3,7 @@ use strict; use warnings FATAL => 'all'; +use APR::URI (); use Apache::RequestUtil (); use Apache::Test; @@ -14,7 +15,7 @@ wais => 210, nntp => 119, snews => 563, - prospero => 1525, + prospero => 191, ); my %status_lines = ( @@ -39,7 +40,9 @@ ok $r->get_limit_req_body || 1; while(my($scheme, $port) = each %default_ports) { - ok Apache::default_port_for_scheme($scheme) == $port; + my $apr_port = APR::URI::default_port_for_scheme($scheme); + #$r->puts("$scheme => expect: $port, got: $apr_port\n"); + ok $apr_port == $port; } while (my($code, $line) = each %status_lines) { 1.4 +8 -5 modperl-2.0/t/response/TestAPI/uri.pm Index: uri.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/uri.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- uri.pm 2001/04/29 17:53:41 1.3 +++ uri.pm 2001/05/22 20:57:46 1.4 @@ -3,8 +3,10 @@ use strict; use warnings FATAL => 'all'; +use APR::URI (); use Apache::URI (); use Apache::RequestUtil (); +use Apache::ServerUtil (); use Apache::Test; my $location = '/' . __PACKAGE__; @@ -12,28 +14,29 @@ sub handler { my $r = shift; - plan $r, tests => 14; + plan $r, tests => 13; $r->args('query'); my $uri = $r->parsed_uri; - ok $uri->isa('Apache::URI'); + ok $uri->isa('APR::URI'); ok $uri->path =~ m:^$location:; my $up = $uri->unparse; ok $up =~ m:^$location:; - my $parsed = Apache::URI->parse($r); + my $curl = $r->construct_url($r->uri, $r->pool); + my $parsed = APR::URI->parse($r, $curl); - ok $parsed->isa('Apache::URI'); + ok $parsed->isa('APR::URI'); $up = $parsed->unparse; ok $up =~ m:$location:; - ok $parsed->query eq $r->args; + #ok $parsed->query eq $r->args; #XXX? my $path = '/foo/bar'; 1.3 +3 -72 modperl-2.0/xs/Apache/URI/Apache__URI.h Index: Apache__URI.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/URI/Apache__URI.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Apache__URI.h 2001/04/29 17:53:41 1.2 +++ Apache__URI.h 2001/05/22 20:57:53 1.3 @@ -1,64 +1,12 @@ -/* subclass uri_components */ -typedef struct { - uri_components uri; - apr_pool_t *pool; - char *path_info; -} modperl_uri_t; - static MP_INLINE -modperl_uri_t *mpxs_uri_new(apr_pool_t *p) +apr_uri_components *mpxs_Apache__RequestRec_parsed_uri(request_rec *r) { - modperl_uri_t *uri = (modperl_uri_t *)apr_pcalloc(p, sizeof(*uri)); - uri->pool = p; - return uri; -} + modperl_uri_t *uri = modperl_uri_new(r->pool); -static MP_INLINE -uri_components *mpxs_Apache__RequestRec_parsed_uri(request_rec *r) -{ - modperl_uri_t *uri = mpxs_uri_new(r->pool); - uri->uri = r->parsed_uri; uri->path_info = r->path_info; - - return (uri_components *)uri; -} - -static MP_INLINE -char *mpxs_ap_unparse_uri_components(pTHX_ - uri_components *uptr, - unsigned flags) -{ - return ap_unparse_uri_components(((modperl_uri_t *)uptr)->pool, - uptr, flags); -} - -static MP_INLINE -uri_components *mpxs_ap_parse_uri_components(pTHX_ - SV *classname, - SV *obj, - const char *uri_string) -{ - request_rec *r = NULL; - apr_pool_t *p = modperl_sv2pool(aTHX_ obj); - modperl_uri_t *uri = mpxs_uri_new(p); - if (!p) { - return NULL; - } - - if (!uri_string) { - r = mp_xs_sv2_r(obj); - uri_string = ap_construct_url(r->pool, r->uri, r); - } - - (void)ap_parse_uri_components(p, uri_string, &uri->uri); - - if (r) { - uri->uri.query = r->args; - } - - return (uri_components *)uri; + return (apr_uri_components *)uri; } static MP_INLINE int mpxs_ap_unescape_url(pTHX_ SV *url) @@ -73,21 +21,4 @@ } return status; -} - -static MP_INLINE -char *mpxs_Apache__URI_port(uri_components *uri, SV *portsv) -{ - dTHX; /*XXX*/ - char *port_str = uri->port_str; - - if (portsv) { - STRLEN len; - char *port = SvPV(portsv, len); - uri->port_str = apr_pstrndup(((modperl_uri_t *)uri)->pool, - port, len); - uri->port = (int)SvIV(portsv); - } - - return port_str; } 1.26 +1 -8 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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- apache_functions.map 2001/05/07 02:05:03 1.25 +++ apache_functions.map 2001/05/22 20:57:58 1.26 @@ -37,7 +37,6 @@ MODULE=Apache::RequestUtil PACKAGE=guess >ap_finalize_request_protocol ?ap_default_port_for_request - ap_default_port_for_scheme ap_default_type ap_get_server_name ap_get_server_port @@ -245,13 +244,7 @@ MODULE=Apache::URI PACKAGE=guess ap_unescape_url | mpxs_ | SV *:url ap_parse_uri -!ap_parse_hostinfo_components - uri_components *:ap_parse_uri_components | mpxs_ | \ - SV *:classname, SV *:p, uri=NULL | parse - ap_unparse_uri_components | mpxs_ | \ - uptr, flags=UNP_OMITPASSWORD | unparse - #special case to set both uri->port and uri->port_str - mpxs_Apache__URI_port | | uri, portsv=Nullsv + PACKAGE=Apache::RequestRec mpxs_Apache__RequestRec_parsed_uri 1.7 +0 -17 modperl-2.0/xs/maps/apache_structures.map Index: apache_structures.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- apache_structures.map 2001/04/29 17:53:42 1.6 +++ apache_structures.map 2001/05/22 20:58:00 1.7 @@ -217,23 +217,6 @@ next </htaccess_result> -<uri_components> - scheme - hostinfo - user - password - hostname -- port_str - path - query - fragment - hostent -~ port - is_initialized - dns_looked_up - dns_resolved -</uri_components> - !<piped_log> p fds 1.4 +0 -1 modperl-2.0/xs/maps/apache_types.map Index: apache_types.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/apache_types.map,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- apache_types.map 2001/04/19 17:41:39 1.3 +++ apache_types.map 2001/05/22 20:58:02 1.4 @@ -6,7 +6,6 @@ struct request_rec | Apache::RequestRec struct subrequest_rec | Apache::SubRequest struct process_rec | Apache::Process -struct uri_components | Apache::URI struct ap_method_list_t | Apache::MethodList struct piped_log | Apache::PipedLog 1.10 +10 -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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- apr_functions.map 2001/04/27 21:12:57 1.9 +++ apr_functions.map 2001/05/22 20:58:04 1.10 @@ -400,6 +400,16 @@ -apr_base64_encode_binary -apr_base64_decode_binary +MODULE=APR::URI +!apr_uri_parse_hostinfo_components + apr_uri_components *:apr_uri_parse_components | mpxs_ | \ + SV *:classname, SV *:p, uri=NULL | parse + apr_uri_unparse_components | mpxs_ | \ + uptr, flags=UNP_OMITPASSWORD | unparse + #special case to set both uri->port and uri->port_str + mpxs_APR__URI_port | | uri, portsv=Nullsv + apr_uri_default_port_for_scheme + !MODULE=Apache::XML apr_text_append apr_xml_parser_create 1.4 +17 -0 modperl-2.0/xs/maps/apr_structures.map Index: apr_structures.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/apr_structures.map,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- apr_structures.map 2001/04/18 05:10:43 1.3 +++ apr_structures.map 2001/05/22 20:58:05 1.4 @@ -153,3 +153,20 @@ text next </apr_text> + +<apr_uri_components> + scheme + hostinfo + user + password + hostname +- port_str + path + query + fragment + hostent +~ port + is_initialized + dns_looked_up + dns_resolved +</apr_uri_components> 1.6 +3 -0 modperl-2.0/xs/maps/apr_types.map Index: apr_types.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/apr_types.map,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apr_types.map 2001/05/04 21:21:54 1.5 +++ apr_types.map 2001/05/22 20:58:06 1.6 @@ -32,6 +32,9 @@ #apr_bucket_simple | UNDEFINED #apr_bucket_shared | UNDEFINED +#uri +struct apr_uri_components | APR::URI + #uuid struct apr_uuid_t | APR::UUID 1.1 modperl-2.0/xs/APR/URI/APR__URI.h Index: APR__URI.h =================================================================== static MP_INLINE char *mpxs_apr_uri_unparse_components(pTHX_ apr_uri_components *uptr, unsigned flags) { return apr_uri_unparse_components(((modperl_uri_t *)uptr)->pool, uptr, flags); } static MP_INLINE apr_uri_components *mpxs_apr_uri_parse_components(pTHX_ SV *classname, SV *obj, const char *uri_string) { request_rec *r = NULL; apr_pool_t *p = modperl_sv2pool(aTHX_ obj); modperl_uri_t *uri = modperl_uri_new(p); if (!p) { return NULL; } #if 0 if (!uri_string) { r = mp_xs_sv2_r(obj); uri_string = ap_construct_url(r->pool, r->uri, r); /*XXX*/ } #endif (void)apr_uri_parse_components(p, uri_string, &uri->uri); if (r) { uri->uri.query = r->args; } return (apr_uri_components *)uri; } static MP_INLINE char *mpxs_APR__URI_port(apr_uri_components *uri, SV *portsv) { dTHX; /*XXX*/ char *port_str = uri->port_str; if (portsv) { STRLEN len; char *port = SvPV(portsv, len); uri->port_str = apr_pstrndup(((modperl_uri_t *)uri)->pool, port, len); uri->port = (int)SvIV(portsv); } return port_str; }