stas 2004/08/17 22:46:11
Modified: . Changes t/protocol/TestProtocol pseudo_http.pm xs/Apache/RequestUtil Apache__RequestUtil.h Log: - test whether we can invoke modperl HTTP handlers on the fake $r - Update Apache::RequestRec->new() to initialize members of request_rec which were added some time ago (without it we were getting segfaults in the new pseudo_http test. Revision Changes Path 1.452 +4 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.451 retrieving revision 1.452 diff -u -u -r1.451 -r1.452 --- Changes 17 Aug 2004 23:40:41 -0000 1.451 +++ Changes 18 Aug 2004 05:46:10 -0000 1.452 @@ -12,6 +12,10 @@ =item 1.99_15-dev +Update Apache::RequestRec->new() to initialize members of request_rec +which were added some time ago (without it we were getting segfaults +in the new pseudo_http test. [Stas] + Apache::CmdParms->limited member replaced by is_method_limited() method [Gozer] 1.6 +11 -1 modperl-2.0/t/protocol/TestProtocol/pseudo_http.pm Index: pseudo_http.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/pseudo_http.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- pseudo_http.pm 9 Aug 2004 00:23:25 -0000 1.5 +++ pseudo_http.pm 18 Aug 2004 05:46:10 -0000 1.6 @@ -26,7 +26,7 @@ sub handler { my $c = shift; my $socket = $c->client_socket; - + if ($socket->opt_get(APR::SO_NONBLOCK)) { $socket->opt_set(APR::SO_NONBLOCK => 0); } @@ -73,6 +73,10 @@ my $c = shift; my $r = Apache::RequestRec->new($c); + + # test whether we can invoke modperl HTTP handlers on the fake $r + $r->push_handlers(PerlAccessHandler => \&my_access); + $r->location_merge(__PACKAGE__); for my $method (qw(run_access_checker run_check_user_id @@ -96,6 +100,12 @@ } } + return Apache::OK; +} + +sub my_access { + # just test that we can invoke a mod_perl HTTP handler + debug "running my_access"; return Apache::OK; } 1.24 +34 -17 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h Index: Apache__RequestUtil.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -u -r1.23 -r1.24 --- Apache__RequestUtil.h 6 Jul 2004 22:06:04 -0000 1.23 +++ Apache__RequestUtil.h 18 Aug 2004 05:46:10 -0000 1.24 @@ -69,30 +69,47 @@ apr_pool_create(&p, base_pool); r = apr_pcalloc(p, sizeof(request_rec)); - r->pool = p; + r->pool = p; r->connection = c; - r->server = s; + r->server = s; + + r->user = NULL; + r->ap_auth_type = NULL; + + r->allowed_methods = ap_make_method_list(p, 1); + + r->headers_in = apr_table_make(p, 1); + r->subprocess_env = apr_table_make(r->pool, 1); + r->headers_out = apr_table_make(p, 1); + r->err_headers_out = apr_table_make(p, 1); + r->notes = apr_table_make(p, 1); - r->hostname = s->server_hostname; r->request_config = ap_create_request_config(p); + + r->proto_output_filters = c->output_filters; + r->output_filters = r->proto_output_filters; + r->proto_input_filters = c->input_filters; + r->input_filters = r->proto_input_filters; + + ap_run_create_request(r); + r->per_dir_config = s->lookup_defaults; - r->method = "GET"; - r->method_number = M_GET; - r->uri = "/"; - r->filename = (char *)ap_server_root_relative(p, r->uri); - - r->the_request = "UNKNOWN"; - r->assbackwards = 1; - r->protocol = "UNKNOWN"; - r->status = HTTP_OK; + r->sent_bodyct = 0; + r->read_length = 0; + r->read_body = REQUEST_NO_BODY; + r->status = HTTP_OK; + r->the_request = "UNKNOWN"; + + r->hostname = s->server_hostname; - r->headers_in = apr_table_make(p, 1); - r->headers_out = apr_table_make(p, 1); - r->err_headers_out = apr_table_make(p, 1); - r->notes = apr_table_make(p, 1); + r->method = "GET"; + r->method_number = M_GET; + r->uri = "/"; + r->filename = (char *)ap_server_root_relative(p, r->uri); - ap_run_create_request(r); + r->assbackwards = 1; + r->protocol = "UNKNOWN"; return r; }