├── BRANCHING ├── CONTRIBUTING.md ├── Changes ├── INSTALL ├── LICENSE ├── META.yml ├── Makefile.PL ├── ModPerl-Registry ├── MANIFEST ├── Makefile.PL ├── README ├── TODO ├── lib │ └── ModPerl │ │ ├── PerlRun.pm │ │ ├── PerlRunPrefork.pm │ │ ├── Registry.pm │ │ ├── RegistryBB.pm │ │ ├── RegistryCooker.pm │ │ ├── RegistryLoader.pm │ │ └── RegistryPrefork.pm └── t │ ├── 206.t │ ├── 304.t │ ├── 404-filename-with-newline.t │ ├── 404.t │ ├── 500.t │ ├── TEST.PL │ ├── bad_scripts.t │ ├── basic.t │ ├── bin_resp.t │ ├── cgi-bin │ ├── 206.pl │ ├── 304.pl │ ├── 404.pl │ ├── basic.pl │ ├── bin_resp_start_0.pl │ ├── cgi.pl │ ├── closure.pl │ ├── content_type.pl │ ├── env.pl │ ├── env_val.pl │ ├── exit.pl │ ├── flush.pl │ ├── ithreads_io_n_tie.pl │ ├── local-conf.pl │ ├── missing_headers.pl │ ├── not_executable.pl │ ├── nph-foo.pl │ ├── perlrun_decl.pm │ ├── perlrun_extload.pl │ ├── perlrun_nondecl.pl │ ├── prefork.pl │ ├── r_inherited.pl │ ├── redirect-cookie.pl │ ├── redirect.pl │ ├── require.pl │ ├── runtime_error.pl │ ├── runtime_error_n_status_change.pl │ ├── runtime_error_plus_body.pl │ ├── send_headers.html │ ├── special_blocks.pl │ ├── status_change.pl │ ├── syntax_error.pl │ └── use_error.pl │ ├── cgi.t │ ├── closure.t │ ├── conf │ ├── extra.conf.in │ └── modperl_extra_startup.pl │ ├── dirindex.t │ ├── fatalstobrowser.t │ ├── flush.t │ ├── ithreads.t │ ├── nph.t │ ├── perlrun_extload.t │ ├── prefork.t │ ├── redirect.t │ ├── regex.t │ ├── rewrite_env.t │ └── special_blocks.t ├── NOTICE ├── README ├── README-SVN ├── RELEASE ├── STATUS ├── SVN-MOVE ├── bin └── mp2bug ├── build ├── config.pl ├── make_etags ├── make_rpm_spec ├── source_scan.pl ├── win32_fetch_apxs └── xs_generate.pl ├── lib ├── APR │ └── XSLoader.pm ├── Apache2 │ ├── Build.pm │ ├── ParseSource.pm │ ├── PerlSections.pm │ ├── PerlSections │ │ └── Dump.pm │ ├── Resource.pm │ ├── SourceTables.pm │ ├── Status.pm │ ├── XSLoader.pm │ ├── compat.pm │ └── porting.pm ├── Bundle │ └── Apache2.pm ├── ModPerl │ ├── BuildMM.pm │ ├── BuildOptions.pm │ ├── CScan.pm │ ├── Code.pm │ ├── Config.pm │ ├── FunctionMap.pm │ ├── MM.pm │ ├── Manifest.pm │ ├── MapUtil.pm │ ├── ParseSource.pm │ ├── StructureMap.pm │ ├── TestReport.pm │ ├── TestRun.pm │ ├── TypeMap.pm │ └── WrapXS.pm └── mod_perl2.pm ├── patches ├── c-scan.pat └── link-hack.pat ├── src └── modules │ └── perl │ ├── mod_perl.c │ ├── mod_perl.h │ ├── modperl_apache_compat.c │ ├── modperl_apache_compat.h │ ├── modperl_apache_includes.h │ ├── modperl_apr_compat.h │ ├── modperl_apr_includes.h │ ├── modperl_bucket.c │ ├── modperl_bucket.h │ ├── modperl_callback.c │ ├── modperl_callback.h │ ├── modperl_cgi.c │ ├── modperl_cgi.h │ ├── modperl_cmd.c │ ├── modperl_cmd.h │ ├── modperl_common_debug.c │ ├── modperl_common_debug.h │ ├── modperl_common_includes.h │ ├── modperl_common_log.c │ ├── modperl_common_log.h │ ├── modperl_common_types.h │ ├── modperl_common_util.c │ ├── modperl_common_util.h │ ├── modperl_config.c │ ├── modperl_config.h │ ├── modperl_const.c │ ├── modperl_const.h │ ├── modperl_debug.c │ ├── modperl_debug.h │ ├── modperl_env.c │ ├── modperl_env.h │ ├── modperl_error.c │ ├── modperl_error.h │ ├── modperl_filter.c │ ├── modperl_filter.h │ ├── modperl_global.c │ ├── modperl_global.h │ ├── modperl_gtop.c │ ├── modperl_gtop.h │ ├── modperl_handler.c │ ├── modperl_handler.h │ ├── modperl_interp.c │ ├── modperl_interp.h │ ├── modperl_io.c │ ├── modperl_io.h │ ├── modperl_io_apache.c │ ├── modperl_io_apache.h │ ├── modperl_log.c │ ├── modperl_log.h │ ├── modperl_mgv.c │ ├── modperl_mgv.h │ ├── modperl_module.c │ ├── modperl_module.h │ ├── modperl_options.c │ ├── modperl_options.h │ ├── modperl_pcw.c │ ├── modperl_pcw.h │ ├── modperl_perl.c │ ├── modperl_perl.h │ ├── modperl_perl_global.c │ ├── modperl_perl_global.h │ ├── modperl_perl_includes.h │ ├── modperl_perl_pp.c │ ├── modperl_perl_pp.h │ ├── modperl_perl_unembed.h │ ├── modperl_svptr_table.c │ ├── modperl_svptr_table.h │ ├── modperl_sys.c │ ├── modperl_sys.h │ ├── modperl_time.h │ ├── modperl_tipool.c │ ├── modperl_tipool.h │ ├── modperl_types.h │ ├── modperl_util.c │ └── modperl_util.h ├── t ├── apache │ ├── add_config.t │ ├── cgihandler.t │ ├── constants.t │ ├── content_length_header.t │ ├── discard_rbody.t │ ├── post.t │ ├── read.t │ ├── read2.t │ ├── read3.t │ ├── read4.t │ ├── scanhdrs.t │ ├── scanhdrs2.t │ └── send_cgi_header.t ├── api │ ├── access2.t │ ├── access2_24.t │ ├── add_config.t │ ├── content_encoding.t │ ├── custom_response.t │ ├── err_headers_out.t │ ├── in_out_filters.t │ ├── internal_redirect.t │ ├── internal_redirect_handler.t │ ├── lookup_misc.t │ ├── lookup_uri.t │ ├── request_rec.t │ ├── rflush.t │ ├── sendfile.t │ ├── slurp_filename.t │ └── status.t ├── apr-ext │ ├── base64.t │ ├── brigade.t │ ├── bucket.t │ ├── date.t │ ├── error.t │ ├── finfo.t │ ├── os.t │ ├── perlio.t │ ├── pool.t │ ├── status.t │ ├── string.t │ ├── table.t │ ├── threadmutex.t │ ├── threadrwlock.t │ ├── uri.t │ ├── util.t │ └── uuid.t ├── apr │ ├── constants.t │ └── pool_lifetime.t ├── compat │ ├── conn_authen.t │ ├── request_body.t │ └── send_fd.t ├── conf │ ├── extra.conf.in │ ├── extra.last.conf.in │ ├── modperl_extra.pl │ └── post_config_startup.pl ├── directive │ ├── perl.t │ ├── perlcleanuphandler.t │ ├── perlloadmodule2.t │ ├── perlloadmodule3.t │ ├── perlloadmodule4.t │ ├── perlloadmodule5.t │ ├── perlloadmodule6.t │ ├── perlmodule.t │ ├── perlrequire.t │ └── setupenv.t ├── error │ ├── runtime.t │ └── syntax.t ├── filter │ ├── TestFilter │ │ ├── both_str_con_add.pm │ │ ├── both_str_native_remove.pm │ │ ├── both_str_req_add.pm │ │ ├── both_str_req_mix.pm │ │ ├── both_str_req_proxy.pm │ │ ├── in_autoload.pm │ │ ├── in_bbs_body.pm │ │ ├── in_bbs_consume.pm │ │ ├── in_bbs_inject_header.pm │ │ ├── in_bbs_msg.pm │ │ ├── in_bbs_underrun.pm │ │ ├── in_error.pm │ │ ├── in_init_basic.pm │ │ ├── in_str_bin_data.pm │ │ ├── in_str_consume.pm │ │ ├── in_str_declined.pm │ │ ├── in_str_declined_read.pm │ │ ├── in_str_lc.pm │ │ ├── in_str_msg.pm │ │ ├── in_str_sandwich.pm │ │ ├── out_bbs_basic.pm │ │ ├── out_bbs_ctx.pm │ │ ├── out_bbs_filebucket.pm │ │ ├── out_init_basic.pm │ │ ├── out_str_api.pm │ │ ├── out_str_buffer.pm │ │ ├── out_str_ctx.pm │ │ ├── out_str_declined.pm │ │ ├── out_str_eval.pm │ │ ├── out_str_lc.pm │ │ ├── out_str_remove.pm │ │ ├── out_str_req_eos.pm │ │ ├── out_str_req_mix.pm │ │ ├── out_str_reverse.pm │ │ ├── out_str_subreq_default.pm │ │ ├── out_str_subreq_modperl.pm │ │ └── with_subrequest.pm │ ├── both_str_con_add.t │ ├── both_str_native_remove.t │ ├── both_str_req_add.t │ ├── both_str_req_mix.t │ ├── both_str_req_proxy.t │ ├── in_autoload.t │ ├── in_bbs_body.t │ ├── in_bbs_consume.t │ ├── in_bbs_inject_header.t │ ├── in_bbs_msg.t │ ├── in_bbs_underrun.t │ ├── in_error.t │ ├── in_init_basic.t │ ├── in_str_bin_data.t │ ├── in_str_consume.t │ ├── in_str_declined.t │ ├── in_str_declined_read.t │ ├── in_str_lc.t │ ├── in_str_msg.t │ ├── in_str_sandwich.t │ ├── out_apache.t │ ├── out_bbs_ctx.t │ ├── out_bbs_filebucket.t │ ├── out_init_basic.t │ ├── out_str_buffer.t │ ├── out_str_ctx.t │ ├── out_str_declined.t │ ├── out_str_lc.t │ ├── out_str_remove.t │ ├── out_str_req_eos.t │ ├── out_str_req_mix.t │ ├── out_str_reverse.t │ ├── out_str_subreq_default.t │ ├── out_str_subreq_modperl.t │ └── with_subrequest.t ├── hooks │ ├── TestHooks │ │ ├── access.pm │ │ ├── authen_basic.pm │ │ ├── authen_digest.pm │ │ ├── authz.pm │ │ ├── cleanup.pm │ │ ├── cleanup2.pm │ │ ├── error.pm │ │ ├── fixup.pm │ │ ├── headerparser.pm │ │ ├── hookrun.pm │ │ ├── init.pm │ │ ├── inlined_handlers.pm │ │ ├── push_handlers.pm │ │ ├── push_handlers_anon.pm │ │ ├── push_handlers_blessed.pm │ │ ├── push_handlers_same_phase.pm │ │ ├── set_handlers.pm │ │ ├── stacked_handlers.pm │ │ ├── stacked_handlers2.pm │ │ ├── startup.pm │ │ └── trans.pm │ ├── access.t │ ├── authen_basic.t │ ├── authen_digest.t │ ├── authz.t │ ├── cleanup.t │ ├── cleanup2.t │ ├── error.t │ ├── hookrun.t │ ├── init.t │ ├── inlined_handlers.t │ ├── push_handlers.t │ ├── push_handlers_anon.t │ ├── stacked_handlers.t │ ├── stacked_handlers2.t │ ├── startup.t │ └── trans.t ├── htdocs │ ├── TestAPI__add_config │ │ └── htaccess │ ├── api │ │ ├── auth-groups │ │ ├── auth-users │ │ ├── custom_response.txt │ │ └── slurp.pl │ ├── filter │ │ ├── reverse.txt │ │ └── subrequest.txt │ ├── includes-registry │ │ ├── cgipm.pl │ │ ├── test.pl │ │ └── test.spl │ ├── includes │ │ ├── clear.shtml │ │ ├── footer.shtml │ │ ├── header.shtml │ │ └── test.shtml │ ├── merge3 │ │ └── htaccess │ ├── modperl │ │ └── setupenv2 │ │ │ ├── config_require.pl │ │ │ ├── module.pm │ │ │ ├── post_config_require.pl │ │ │ └── require.pl │ ├── perlio │ │ ├── MoonRise.jpeg │ │ └── redrum.txt │ ├── protocols │ │ └── basic-auth │ └── vhost │ │ ├── post_config.pl │ │ └── startup.pl ├── lib │ ├── TestAPRlib │ │ ├── base64.pm │ │ ├── brigade.pm │ │ ├── bucket.pm │ │ ├── date.pm │ │ ├── error.pm │ │ ├── finfo.pm │ │ ├── os.pm │ │ ├── pool.pm │ │ ├── status.pm │ │ ├── string.pm │ │ ├── table.pm │ │ ├── threadmutex.pm │ │ ├── threadrwlock.pm │ │ ├── uri.pm │ │ ├── util.pm │ │ └── uuid.pm │ ├── TestCommon │ │ ├── FilterDebug.pm │ │ ├── Handlers.pm │ │ ├── LogDiff.pm │ │ ├── MemoryLeak.pm │ │ ├── SameInterp.pm │ │ ├── TiePerlSection.pm │ │ └── Utils.pm │ └── TestExit │ │ └── FromPerlModule.pm ├── modperl │ ├── cookie.t │ ├── cookie2.t │ ├── exit.t │ ├── getc.t │ ├── local_env.t │ ├── merge.t │ ├── merge2.t │ ├── merge3.t │ ├── perl_options.t │ ├── perl_options2.t │ ├── pnotes.t │ ├── pnotes2.t │ ├── post_utf8.t │ ├── print_utf8.t │ ├── print_utf8_2.t │ ├── readline.t │ ├── request_rec_perlio_api.t │ ├── setupenv.t │ ├── setupenv2.t │ └── status.t ├── modules │ ├── apache_resource.t │ ├── apache_status.t │ ├── cgi.t │ ├── cgi2.t │ ├── cgipost.t │ ├── cgipost2.t │ ├── cgiupload.t │ ├── cgiupload2.t │ ├── include.t │ ├── include2.t │ ├── include_subreq.t │ └── proxy.t ├── perl │ ├── hash_attack.t │ ├── ithreads.t │ ├── ithreads2.t │ └── ithreads3.t ├── preconnection │ ├── TestPreConnection │ │ └── note.pm │ └── note.t ├── protocol │ ├── TestProtocol │ │ ├── echo_bbs.pm │ │ ├── echo_bbs2.pm │ │ ├── echo_block.pm │ │ ├── echo_filter.pm │ │ ├── echo_nonblock.pm │ │ ├── echo_timeout.pm │ │ ├── eliza.pm │ │ └── pseudo_http.pm │ ├── echo_bbs.t │ ├── echo_bbs2.t │ ├── echo_block.t │ ├── echo_filter.t │ ├── echo_nonblock.t │ ├── echo_timeout.t │ ├── eliza.t │ └── pseudo_http.t ├── response │ ├── TestAPI │ │ ├── access.pm │ │ ├── access2.pm │ │ ├── access2_24.pm │ │ ├── add_config.pm │ │ ├── aplog.pm │ │ ├── command.pm │ │ ├── conn_rec.pm │ │ ├── conn_util.pm │ │ ├── content_encoding.pm │ │ ├── custom_response.pm │ │ ├── err_headers_out.pm │ │ ├── in_out_filters.pm │ │ ├── internal_redirect.pm │ │ ├── internal_redirect_handler.pm │ │ ├── lookup_misc.pm │ │ ├── lookup_uri.pm │ │ ├── lookup_uri2.pm │ │ ├── module.pm │ │ ├── process.pm │ │ ├── query.pm │ │ ├── request_rec.pm │ │ ├── request_subclass.pm │ │ ├── request_util.pm │ │ ├── response.pm │ │ ├── rflush.pm │ │ ├── sendfile.pm │ │ ├── server_const.pm │ │ ├── server_rec.pm │ │ ├── server_util.pm │ │ ├── show.pm │ │ ├── slurp_filename.pm │ │ ├── status.pm │ │ ├── sub_request.pm │ │ └── uri.pm │ ├── TestAPR │ │ ├── base64.pm │ │ ├── brigade.pm │ │ ├── bucket.pm │ │ ├── date.pm │ │ ├── finfo.pm │ │ ├── flatten.pm │ │ ├── ipsubnet.pm │ │ ├── os.pm │ │ ├── perlio.pm │ │ ├── pool.pm │ │ ├── pool_lifetime.pm │ │ ├── sockaddr.pm │ │ ├── socket.pm │ │ ├── status.pm │ │ ├── string.pm │ │ ├── table.pm │ │ ├── threadmutex.pm │ │ ├── threadrwlock.pm │ │ ├── uri.pm │ │ ├── util.pm │ │ └── uuid.pm │ ├── TestApache │ │ ├── cgihandler.pm │ │ ├── conftree.pm │ │ ├── content_length_header.pm │ │ ├── daemon.pm │ │ ├── discard_rbody.pm │ │ ├── post.pm │ │ ├── read.pm │ │ ├── read2.pm │ │ ├── read3.pm │ │ ├── read4.pm │ │ ├── scanhdrs.pm │ │ ├── scanhdrs2.pm │ │ ├── send_cgi_header.pm │ │ ├── subprocess.pm │ │ ├── util.pm │ │ └── write.pm │ ├── TestCompat │ │ ├── apache.pm │ │ ├── apache_file.pm │ │ ├── apache_module.pm │ │ ├── apache_table.pm │ │ ├── apache_uri.pm │ │ ├── apache_util.pm │ │ ├── conn_authen.pm │ │ ├── conn_rec.pm │ │ ├── request.pm │ │ ├── request_body.pm │ │ └── send_fd.pm │ ├── TestDirective │ │ ├── cmdparms.pm │ │ ├── env.pm │ │ ├── perlcleanuphandler.pm │ │ ├── perldo.pm │ │ ├── perlloadmodule.pm │ │ ├── perlloadmodule2.pm │ │ ├── perlloadmodule3.pm │ │ ├── perlloadmodule4.pm │ │ ├── perlloadmodule5.pm │ │ ├── perlloadmodule6.pm │ │ ├── perlloadmodule7.pm │ │ ├── perlmodule.pm │ │ ├── perlrequire.pm │ │ ├── pod.pm │ │ └── setupenv.pm │ ├── TestError │ │ ├── api.pm │ │ ├── runtime.pm │ │ └── syntax.pm │ ├── TestModperl │ │ ├── cookie.pm │ │ ├── cookie2.pm │ │ ├── current_callback.pm │ │ ├── dir_config.pm │ │ ├── endav.pm │ │ ├── env.pm │ │ ├── exit.pm │ │ ├── getc.pm │ │ ├── interpreter.pm │ │ ├── io_nested_with_closed_stds.pm │ │ ├── io_with_closed_stds.pm │ │ ├── local_env.pm │ │ ├── merge.pm │ │ ├── method.pm │ │ ├── methodname.pm │ │ ├── methodobj.pm │ │ ├── perl.pm │ │ ├── perl_options.pm │ │ ├── perl_options2.pm │ │ ├── pnotes.pm │ │ ├── pnotes2.pm │ │ ├── post_utf8.pm │ │ ├── print.pm │ │ ├── print_utf8.pm │ │ ├── print_utf8_2.pm │ │ ├── printf.pm │ │ ├── readline.pm │ │ ├── request_rec_perlio_api.pm │ │ ├── request_rec_tie_api.pm │ │ ├── setauth.pm │ │ ├── setupenv.pm │ │ ├── setupenv2.pm │ │ ├── status.pm │ │ ├── stdfd.pm │ │ ├── stdfd2.pm │ │ ├── subenv.pm │ │ ├── taint.pm │ │ └── util.pm │ ├── TestModules │ │ ├── cgi.pm │ │ ├── cgi2.pm │ │ ├── cgipost.pm │ │ ├── cgipost2.pm │ │ ├── cgiupload.pm │ │ ├── cgiupload2.pm │ │ ├── include_subreq.pm │ │ └── proxy.pm │ ├── TestPerl │ │ ├── api.pm │ │ ├── hash_attack.pm │ │ ├── ithreads.pm │ │ ├── ithreads3.pm │ │ ├── ithreads_args.pm │ │ ├── ithreads_eval.pm │ │ └── signals.pm │ ├── TestUser │ │ └── rewrite.pm │ └── TestVhost │ │ ├── config.pm │ │ └── log.pm ├── user │ ├── README │ └── rewrite.t └── vhost │ ├── config.t │ └── log.t ├── todo ├── 2.0.6 ├── README ├── api_status ├── bugs_apr_ext ├── bugs_build ├── bugs_mp ├── bugs_registry ├── design_notes ├── docs ├── features_deprecated ├── features_maybe ├── features_missing ├── features_new ├── features_optimization ├── features_registry ├── release ├── tests_issues └── tests_wanted ├── util ├── apr_arg_check.pl ├── apr_pool_check.pl ├── cvsize.pl ├── getdiff.pl ├── methodlookup_check.pl ├── perl_bloat.pl ├── sizeof.pl ├── source_stats.pl └── xs_check.pl └── xs ├── APR ├── APR │ ├── APR.pm │ ├── APR.xs │ ├── Makefile.PL │ └── apr-test ├── Base64 │ └── APR__Base64.h ├── Brigade │ └── APR__Brigade.h ├── Bucket │ └── APR__Bucket.h ├── BucketAlloc │ └── APR__BucketAlloc.h ├── Const │ ├── Const.pm │ ├── Const.xs │ └── Makefile.PL ├── Error │ ├── APR__Error.h │ └── Error_pm ├── Finfo │ └── APR__Finfo.h ├── IpSubnet │ └── APR__IpSubnet.h ├── Lock │ └── APR__Lock.h ├── Makefile.PL ├── OS │ └── APR__OS.h ├── PerlIO │ ├── Makefile.PL │ ├── PerlIO.pm │ ├── PerlIO.xs │ ├── modperl_apr_perlio.c │ └── modperl_apr_perlio.h ├── Pool │ └── APR__Pool.h ├── SockAddr │ └── APR__SockAddr.h ├── Socket │ └── APR__Socket.h ├── Status │ └── APR__Status.h ├── String │ └── APR__String.h ├── Table │ └── APR__Table.h ├── ThreadMutex │ └── APR__ThreadMutex.h ├── ThreadRWLock │ └── APR__ThreadRWLock.h ├── URI │ └── APR__URI.h ├── UUID │ └── APR__UUID.h ├── Util │ └── APR__Util.h └── aprext │ ├── Makefile.PL │ └── modperl_dummy.c ├── Apache2 ├── Access │ └── Apache2__Access.h ├── CmdParms │ └── Apache2__CmdParms.h ├── Command │ └── Apache2__Command.h ├── Connection │ └── Apache2__Connection.h ├── ConnectionUtil │ └── Apache2__ConnectionUtil.h ├── Const │ ├── Const.pm │ ├── Const.xs │ └── Makefile.PL ├── Directive │ └── Apache2__Directive.h ├── Filter │ └── Apache2__Filter.h ├── Log │ └── Apache2__Log.h ├── MPM │ └── Apache2__MPM.h ├── Makefile.PL ├── Module │ └── Apache2__Module.h ├── RequestIO │ └── Apache2__RequestIO.h ├── RequestRec │ └── Apache2__RequestRec.h ├── RequestUtil │ └── Apache2__RequestUtil.h ├── Response │ └── Apache2__Response.h ├── ServerRec │ ├── Apache2__ServerRec.h │ └── ServerRec_pm ├── ServerUtil │ └── Apache2__ServerUtil.h ├── SubProcess │ ├── Apache2__SubProcess.h │ └── SubProcess_pm ├── SubRequest │ └── Apache2__SubRequest.h ├── URI │ └── Apache2__URI.h └── Util │ └── Apache2__Util.h ├── Makefile.PL ├── ModPerl ├── Const │ ├── Const.pm │ ├── Const.xs │ └── Makefile.PL ├── Global │ └── ModPerl__Global.h ├── Interpreter │ └── ModPerl__Interpreter.h ├── Makefile.PL └── Util │ ├── ModPerl__Util.h │ └── Util_pm ├── maps ├── apache2_functions.map ├── apache2_structures.map ├── apache2_types.map ├── apr_functions.map ├── apr_structures.map ├── apr_types.map ├── modperl_functions.map ├── modperl_structures.map └── modperl_types.map ├── modperl_xs_util.h ├── tables ├── current │ ├── APR │ │ └── FunctionTable.pm │ ├── Apache2 │ │ ├── ConstantsTable.pm │ │ ├── FunctionTable.pm │ │ └── StructureTable.pm │ └── ModPerl │ │ └── FunctionTable.pm └── current24 │ ├── APR │ └── FunctionTable.pm │ ├── Apache2 │ ├── ConstantsTable.pm │ ├── FunctionTable.pm │ └── StructureTable.pm │ └── ModPerl │ └── FunctionTable.pm └── typemap /INSTALL: -------------------------------------------------------------------------------- 1 | Simple install: 2 | 3 | % perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs 4 | % make && make test 5 | % make install 6 | 7 | Simple install on AIX: 8 | 9 | You will need GNU make to compile mod_perl. The AIX make does not work. 10 | If you have installed GNU make from the AIX Toolbox: 11 | 12 | % export MAKE="/opt/freeware/bin/gmake" 13 | % perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs 14 | % gmake && gmake test 15 | % gmake install 16 | 17 | Simple config: 18 | 19 | LoadModule perl_module modules/mod_perl.so 20 | #PerlModule Apache::compat 21 | # your config comes here 22 | 23 | For a more detailed version (including more options) refer to: 24 | 25 | docs/user/intro/start_fast.pod 26 | 27 | or online: 28 | 29 | http://perl.apache.org/docs/2.0/user/intro/start_fast.html 30 | 31 | For an even more detailed documentation refer to: 32 | 33 | docs/user/install/install.pod 34 | docs/user/config/config.pod 35 | 36 | or online: 37 | 38 | http://perl.apache.org/docs/2.0/user/install/install.pod 39 | http://perl.apache.org/docs/2.0/user/config/config.pod 40 | 41 | -------------------------------------------------------------------------------- /META.yml: -------------------------------------------------------------------------------- 1 | name: mod_perl 2 | version: 2.0.14 3 | installdirs: site 4 | distribution_type: module 5 | no_index: 6 | directory: 7 | # A-T and others have their own CPAN distros 8 | - Apache-Test 9 | - Apache-Reload 10 | - Apache-SizeLimit 11 | package: 12 | # Internally redefined module 13 | - C::Preprocessed 14 | # Fake packages 15 | - Apache::Status::_version 16 | - perlrun_decl 17 | # Apache::compat redefines 18 | - Apache 19 | - Apache::Constants 20 | - Apache::File 21 | - Apache::SIG 22 | - Apache::Server 23 | - Apache::Table 24 | - Apache::Util 25 | -------------------------------------------------------------------------------- /ModPerl-Registry/MANIFEST: -------------------------------------------------------------------------------- 1 | MANIFEST This list of files 2 | Makefile.PL 3 | README 4 | TODO 5 | lib/ModPerl/PerlRun.pm 6 | lib/ModPerl/Registry.pm 7 | lib/ModPerl/RegistryBB.pm 8 | lib/ModPerl/RegistryCooker.pm 9 | t/TEST.PL 10 | t/basic.t 11 | t/closure.t 12 | t/cgi-bin/basic.pl 13 | t/cgi-bin/closure.pl 14 | t/cgi-bin/env.pl 15 | t/cgi-bin/local-conf.pl 16 | t/cgi-bin/not_executable.pl 17 | t/cgi-bin/require.pl 18 | t/conf/extra.conf.in 19 | 20 | -------------------------------------------------------------------------------- /ModPerl-Registry/README: -------------------------------------------------------------------------------- 1 | to be written 2 | -------------------------------------------------------------------------------- /ModPerl-Registry/TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/mod_perl/ead5012b9f8bca08415f39e15226dbc6112a9538/ModPerl-Registry/TODO -------------------------------------------------------------------------------- /ModPerl-Registry/lib/ModPerl/PerlRunPrefork.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package ModPerl::PerlRunPrefork; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | our $VERSION = '0.01'; 8 | 9 | use base qw(ModPerl::PerlRun); 10 | 11 | if ($ENV{MOD_PERL}) { 12 | require Apache2::MPM; 13 | die "This package can't be used under threaded MPMs" 14 | if Apache2::MPM->is_threaded; 15 | } 16 | 17 | sub handler : method { 18 | my $class = (@_ >= 2) ? shift : __PACKAGE__; 19 | my $r = shift; 20 | return $class->new($r)->default_handler(); 21 | } 22 | 23 | *chdir_file = \&ModPerl::RegistryCooker::chdir_file_normal; 24 | 25 | 1; 26 | __END__ 27 | -------------------------------------------------------------------------------- /ModPerl-Registry/lib/ModPerl/RegistryPrefork.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package ModPerl::RegistryPrefork; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | our $VERSION = '0.01'; 8 | 9 | use base qw(ModPerl::Registry); 10 | 11 | if ($ENV{MOD_PERL}) { 12 | require Apache2::MPM; 13 | die "This package can't be used under threaded MPMs" 14 | if Apache2::MPM->is_threaded; 15 | } 16 | 17 | sub handler : method { 18 | my $class = (@_ >= 2) ? shift : __PACKAGE__; 19 | my $r = shift; 20 | return $class->new($r)->default_handler(); 21 | } 22 | 23 | *chdir_file = \&ModPerl::RegistryCooker::chdir_file_normal; 24 | 25 | 1; 26 | __END__ 27 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/206.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | 9 | plan tests => 2, need [qw(mod_alias.c HTML::HeadParser)]; 10 | 11 | my $url = "/registry/206.pl"; 12 | my $res = GET($url); 13 | my $body = 'code, 17 | 206, 18 | "test partial_content: response code", 19 | ); 20 | 21 | ok t_cmp( 22 | $res->content, 23 | $body, 24 | "test partial_content: response body", 25 | ); 26 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/404-filename-with-newline.t: -------------------------------------------------------------------------------- 1 | #!perl 2 | 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | use Apache::TestRequest qw(GET_RC); 9 | 10 | plan tests => 1, need 'mod_alias.c'; 11 | 12 | { 13 | # this used to result in 500 due to a combination of Perl warning about 14 | # a newline in the filename passed to stat() and our 15 | # use warnings FATAL=>'all' 16 | 17 | t_client_log_error_is_expected(); 18 | my $url = '/registry/file%0dwith%0anl%0d%0aand%0a%0dcr'; 19 | ok t_cmp GET_RC($url), 404, 'URL with \\r and \\n embedded'; 20 | } 21 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/404.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET_BODY GET); 8 | 9 | plan tests => 2, need [qw(mod_alias.c HTML::HeadParser)]; 10 | 11 | { 12 | t_client_log_error_is_expected(); 13 | my $url = "/error_document/cannot_be_found"; 14 | my $response = "Oops, can't find the requested doc"; 15 | ok t_cmp( 16 | GET_BODY($url), 17 | $response, 18 | "test ErrorDocument" 19 | ); 20 | } 21 | 22 | 23 | { 24 | my $url = "/registry/status_change.pl"; 25 | my $res = GET($url); 26 | ok t_cmp( 27 | $res->code, 28 | 404, 29 | "the script has changed the status to 404" 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/bad_scripts.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | 9 | plan tests => 1, need 'mod_alias.c'; 10 | 11 | { 12 | t_client_log_error_is_expected(); 13 | my $url = "/perlrun/r_inherited.pl"; 14 | my $res = GET($url); 15 | ok t_cmp( 16 | $res->code, 17 | 500, 18 | "the script hasn't declared its private \$r", 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/bin_resp.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | # testing various binary responses 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | use Apache::TestRequest; 10 | 11 | plan tests => 2, need 'mod_alias.c'; 12 | 13 | # 2 sub-tests 14 | { 15 | # favicon.ico and other .ico image/x-icon images start with 16 | # sequence: 17 | my $expected = "\000\000\001\000"; 18 | my $location = "/registry/bin_resp_start_0.pl"; 19 | #my $location = "/cgi-bin/bin_resp_start_0.pl"; 20 | 21 | my $received = GET_BODY_ASSERT $location; 22 | 23 | #t_debug "$received"; 24 | 25 | ok t_cmp(length($received), length($expected), "image size"); 26 | 27 | t_debug "comparing the binary contents"; 28 | ok $expected eq $received; 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/206.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | print <<_OUT_; 3 | Status: 206 Partial Content 4 | Content-Type: text/html; charset=UTF-8 5 | Content-Length: 11 6 | Content-Range: bytes 0-10/1336 7 | Date: Fri, 31 Jan 2003 09:39:01 GMT 8 | ETag: "xxxx" 9 | 10 | _OUT_ 11 | print 'content_type('text/plain'); 7 | print "Oops, can't find the requested doc"; 8 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/basic.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # test all the basic functionality 5 | 6 | print "Content-type: text/plain\n\n"; 7 | 8 | # test that __END__ can appear in a comment w/o cutting data after it 9 | 10 | print "ok $0"; 11 | 12 | # test that __END__ starting at the beginning of the line makes 13 | # everything following it, stripped 14 | __END__ 15 | 16 | this is some irrelevant data 17 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/bin_resp_start_0.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | # favicon.ico and other .ico image/x-icon images start with this sequence 8 | my $response = "\000\000\001\000"; 9 | 10 | # test here that the cgi header parser doesn't get confused and decide 11 | # that there is no response body if it starts with \000 sequence 12 | 13 | print "Content-type: image/x-icon\n\n"; 14 | print $response; 15 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/cgi.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use CGI qw/:standard :html3/; 3 | 4 | print header(-type=>'text/html'); 5 | print b("done"); 6 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/closure.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | BEGIN { 5 | use Apache::TestUtil qw/t_server_log_warn_is_expected/; 6 | t_server_log_warn_is_expected(); 7 | } 8 | 9 | # this script will suffer from a closure problem under registry 10 | # should see it under ::Registry 11 | # should not see it under ::PerlRun 12 | 13 | print "Content-type: text/plain\n\n"; 14 | 15 | # this is a closure (when compiled inside handler()): 16 | my $counter = 0; 17 | counter(); 18 | 19 | sub counter { 20 | #warn "$$: counter=$counter"; 21 | print ++$counter; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/content_type.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | my $r = shift; 3 | $r->content_type('text/plain'); 4 | $r->print('ok'); 5 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/env.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # test env vars 3 | 4 | print "Content-type: text/plain\n\n"; 5 | print exists $ENV{QUERY_STRING} && $ENV{QUERY_STRING}; 6 | 7 | __END__ 8 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/env_val.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # test env vars 3 | 4 | print "Content-type: text/plain\n\n"; 5 | my $var = $ENV{QUERY_STRING}; 6 | print exists $ENV{$var} && $ENV{$var}; 7 | 8 | __END__ 9 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/exit.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # XXX: exit should work by stopping the script, but not quitting the 3 | # interpreter, though it's not trivial to make an automated test since 4 | # what you really want to check whether the process didn't quit after 5 | # exit was called. Things become more complicated with 6 | # ithreads-enabled perls where one process may have many interpreters 7 | # and you can't really track those at the moment. So this test needs 8 | # more work. 9 | 10 | print "Content-type: text/plain\n\n"; 11 | 12 | print "before exit"; 13 | 14 | exit; 15 | 16 | print "after exit"; 17 | 18 | 19 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/flush.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | local $| = 1; # unbuffered mode 6 | 7 | my $r = shift; 8 | 9 | print "Content-Type: text/html\n\n"; 10 | print "yet another boring test string"; 11 | 12 | # This line passes a bucket brigade with a single bucket FLUSH 13 | # it was causing problems in the mod_deflate filter which was trying to 14 | # deflate empty output buffer, (the previous print has already flushed 15 | # all the output) (the fix in mod_deflate.c was to check whether the 16 | # buffer is full) 17 | print ""; 18 | 19 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/local-conf.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | $test_require = 'it works'; 3 | 4 | 1; 5 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/missing_headers.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | print "No HTTP headers were sent\n\n"; 7 | 8 | print "Here is some more body coming\n even with double new line\n\n"; 9 | print "Here is some more body coming"; 10 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/not_executable.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # this test should return forbidden, since it should be not-executable 5 | 6 | print "Content-type: text/plain\n\n"; 7 | print "ok"; 8 | 9 | __END__ 10 | 11 | this is some irrelevant data 12 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/nph-foo.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | my $r = shift; 5 | 6 | print "HTTP/1.0 250 Pretty OK\r\n"; 7 | print join("\n", 8 | 'Content-type: text/text', 9 | 'Pragma: no-cache', 10 | 'Cache-control: must-revalidate, no-cache, no-store', 11 | 'Expires: -1', 12 | "\n"); 13 | 14 | print "non-parsed headers body"; 15 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/perlrun_decl.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package perlrun_decl; 3 | 4 | use warnings; 5 | use strict; 6 | 7 | use base qw(Exporter); 8 | our @EXPORT = qw(decl_proto); 9 | 10 | # this BEGIN block is called only once, since this module doesn't get 11 | # removed from %INC after it was loaded 12 | BEGIN { 13 | # use an external package which will persist across requests 14 | $MyData::blocks{perlrun_decl}++; 15 | } 16 | 17 | sub decl_proto ($;$) { shift } 18 | 19 | # this END block won't be executed until the server shutdown 20 | END { 21 | $MyData::blocks{perlrun_decl}--; 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/prefork.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # test that prefork runs from the directory the script lives in 5 | 6 | # All Modperl::*Prefork modules must chdir into the current dir, so we 7 | # should be able to read ourselves via a relative path 8 | 9 | print "Content-type: text/plain\n\n"; 10 | 11 | my $script = "prefork.pl"; 12 | if (open my $fh, $script) { 13 | print "ok $script"; 14 | } 15 | else { 16 | print "prefork didn't chdir into the scripts directory?"; 17 | print " The error was: $!"; 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/r_inherited.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings; 4 | 5 | # this script shouldn't work 6 | 7 | # this is to test that $r is not in the scope from the function that 8 | # has compiled this script in the registry module 9 | 10 | # my $r = shift; 11 | 12 | $r->content_type('text/plain'); 13 | $r->print($r->args); 14 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/redirect-cookie.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # test env vars 3 | 4 | use Apache2::URI (); 5 | use Apache2::Const -compile => qw(REDIRECT SERVER_ERROR); 6 | 7 | my $r = shift; 8 | my $path = $r->args || ''; 9 | $server = $r->construct_server; 10 | 11 | $r->err_headers_out->set('Set-Cookie' => "mod_perl=ubercool; path=/"); 12 | $r->headers_out->set(Location => " http://$server$path"); 13 | $r->status(Apache2::Const::REDIRECT); 14 | 15 | # exit status is completely ignored in Registry 16 | # due to $r->status hacking 17 | return Apache2::Const::SERVER_ERROR; 18 | 19 | __END__ 20 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/redirect.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # test env vars 3 | 4 | use Apache2::URI (); 5 | 6 | my $r = shift; 7 | my $path = $r->args || ''; 8 | $server = $r->construct_server; 9 | 10 | print "Location: http://$server$path\n\n"; 11 | #warn "Location: http://$server$path\n\n"; 12 | 13 | __END__ 14 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/require.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # test the require 3 | 4 | use Apache::Test (); 5 | use File::Spec::Functions qw(catfile); 6 | 7 | my $vars = Apache::Test::config()->{vars}; 8 | my $require = catfile $vars->{serverroot}, 'cgi-bin', 'local-conf.pl'; 9 | 10 | print "Content-type: text/plain\n\n"; 11 | 12 | # XXX: meanwhile we don't chdir to the script's dir 13 | delete $INC{$require}; 14 | require $require; 15 | 16 | print defined $test_require && $test_require; 17 | 18 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/runtime_error.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | 7 | # this script sends no body at all, and since the error happens 8 | # the script will return 500 9 | 10 | print "Content-type: text/plain\n\n"; 11 | print no_such_func(); 12 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | 7 | use Apache2::Const -compile => qw(NOT_FOUND); 8 | 9 | my $r = shift; 10 | $r->status(Apache2::Const::NOT_FOUND); 11 | $r->print("Content-type: text/plain\n\n"); 12 | $r->print(no_such_func()); 13 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/runtime_error_plus_body.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | 7 | # this script sends some body before the error happens, 8 | # so 200 OK is expected, followed by an error 9 | print "Content-type: text/plain\n\n"; 10 | print "some body"; 11 | print no_such_func(); 12 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/send_headers.html: -------------------------------------------------------------------------------- 1 | print "Content-type: text/plain\n\n"; 2 | print "ok"; 3 | 4 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/special_blocks.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # test BEGIN/END blocks 5 | 6 | use Apache2::RequestRec (); 7 | 8 | use vars qw($query); 9 | $query = '' unless defined $query; 10 | 11 | BEGIN { 12 | $query = $ENV{QUERY_STRING}; 13 | } 14 | 15 | print "Content-type: text/plain\n\n"; 16 | 17 | my $r = shift; 18 | our $test = $r->args || ''; 19 | 20 | if ($test eq 'uncache') { 21 | # mark the script as non-cached for the next execution 22 | require ModPerl::RegistryCooker; 23 | ModPerl::RegistryCooker::uncache_myself(); 24 | } 25 | elsif ($test eq 'begin') { 26 | print "begin ok" if $query eq 'begin'; 27 | # reset the global 28 | $query = ''; 29 | } 30 | 31 | END { 32 | if (defined $test && $test eq 'end') { 33 | print "end ok"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/status_change.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache2::Const -compile => qw(NOT_FOUND); 3 | 4 | my $r = shift; 5 | $r->status(Apache2::Const::NOT_FOUND); 6 | $r->print("Content-type: text/plain\n\n"); 7 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/syntax_error.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | 7 | print "Content-type: text/plain\n\n"; 8 | 9 | # the following syntax error is here on purpose! 10 | 11 | lkj;\; 12 | 13 | print "done"; 14 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi-bin/use_error.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | BEGIN { 3 | use Apache::TestUtil; 4 | t_server_log_error_is_expected(); 5 | } 6 | 7 | use DoesNotExist (); 8 | 9 | print "Content-type: text/plain\n\n"; 10 | print "this script is expected to fail"; 11 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/cgi.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | 9 | plan tests => 2, need [qw(mod_alias.c HTML::HeadParser)], 10 | need_min_module_version CGI => 3.08; 11 | 12 | my $url = "/registry/cgi.pl"; 13 | my $res = GET $url; 14 | 15 | ok t_cmp($res->header('Content-type'), 16 | qr{^text/html}, 17 | "test 'Content-type header setting"); 18 | 19 | ok t_cmp(lc($res->content), 20 | 'done', 21 | "test body"); 22 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/dirindex.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | 9 | plan tests => 2, need [qw(mod_alias.c HTML::HeadParser mod_dir.c)], 10 | need_min_module_version CGI => 3.08; 11 | 12 | { 13 | my $url = "/dirindex/"; 14 | my $res = GET $url; 15 | 16 | ok t_cmp($res->header('Content-type'), 17 | qr{^text/html}, 18 | "DirectoryIndex + AddHandler - Content-type"); 19 | 20 | ok t_cmp(lc($res->content), 21 | 'done', 22 | "DirectoryIndex + AddHandler - body"); 23 | } 24 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/flush.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET_BODY); 8 | 9 | plan tests => 1, need [qw(mod_alias.c deflate HTML::HeadParser)], 10 | need_min_module_version("Compress::Zlib", "1.09"), 11 | need_min_apache_version("2.0.48"); 12 | # it requires httpd 2.0.48 because of the bug in mod_deflate: 13 | # http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22259 14 | 15 | require Compress::Zlib; 16 | 17 | my $url = "/registry_bb_deflate/flush.pl"; 18 | 19 | my $expected = "yet another boring test string"; 20 | my $received = GET_BODY $url, 'Accept-encoding' => 'gzip'; 21 | my $decompressed = Compress::Zlib::memGunzip($received); 22 | 23 | ok t_cmp( 24 | $decompressed, 25 | $expected, 26 | "test flush body" 27 | ); 28 | 29 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/ithreads.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | use Config; 10 | 11 | use constant HAS_ITHREADS => ($] >= 5.008001 && $Config{useithreads}); 12 | 13 | plan tests => 1, need 'mod_alias.c', 14 | {"perl 5.8.1 or higher w/ithreads enabled is required" => HAS_ITHREADS}; 15 | 16 | { 17 | # the order of prints on the server side is not important here, 18 | # what's important is that we get all the printed strings 19 | my @expected = sort map("thread $_", 1..4), "parent"; 20 | my $url = "/registry_modperl_handler/ithreads_io_n_tie.pl"; 21 | my $received = GET_BODY_ASSERT($url) || ''; 22 | my @received = sort split /\n/, $received; 23 | ok t_cmp \@received, \@expected; 24 | } 25 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/perlrun_extload.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | use TestCommon::SameInterp; 9 | 10 | plan tests => 2, need [qw(mod_alias.c HTML::HeadParser)]; 11 | 12 | my $url = "/same_interp/perlrun/perlrun_extload.pl"; 13 | my $same_interp = Apache::TestRequest::same_interp_tie($url); 14 | 15 | for (1..2) { 16 | # should not fail on the second request 17 | my $res = same_interp_req_body($same_interp, \&GET, $url); 18 | same_interp_skip_not_found( 19 | !defined($res), 20 | $res, 21 | "d1nd1234", 22 | "PerlRun requiring an external lib with subs", 23 | ); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/regex.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil qw(t_cmp t_catfile_apache); 7 | use Apache::TestRequest; 8 | use Apache::TestConfig (); 9 | 10 | my %modules = ( 11 | registry => 'ModPerl::Registry', 12 | registry_bb => 'ModPerl::RegistryBB', 13 | perlrun => 'ModPerl::PerlRun', 14 | ); 15 | 16 | my @aliases = sort keys %modules; 17 | 18 | plan tests => @aliases * 1, need 'mod_alias.c'; 19 | 20 | my $vars = Apache::Test::config()->{vars}; 21 | my $script_file = t_catfile_apache $vars->{serverroot}, 'cgi-bin', 'basic.pl'; 22 | 23 | # extended regex quoting 24 | # CVE-2007-1349 (which doesn't affect any of our shipped handlers) 25 | 26 | for my $alias (@aliases) { 27 | my $url = "/$alias/basic.pl/("; 28 | 29 | ok t_cmp( 30 | GET_BODY($url), 31 | "ok $script_file", 32 | "$modules{$alias} regex in path_info", 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /ModPerl-Registry/t/rewrite_env.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest qw(GET); 8 | 9 | plan tests => 1, need [qw(mod_alias.c mod_rewrite.c)]; 10 | 11 | { 12 | my $url = "/rewritetest"; 13 | my $res = GET $url; 14 | 15 | ok t_cmp($res->content(), 16 | "GOTCHA", 17 | 'found environment variable from mod_rewrite'); 18 | } 19 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | This product includes software developed by 2 | The Apache Software Foundation (http://www.apache.org/). 3 | -------------------------------------------------------------------------------- /SVN-MOVE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/mod_perl/ead5012b9f8bca08415f39e15226dbc6112a9538/SVN-MOVE -------------------------------------------------------------------------------- /build/config.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use FindBin qw($Bin); 6 | use lib "$Bin/../lib"; 7 | 8 | use ModPerl::Config (); 9 | 10 | print ModPerl::Config::as_string(); 11 | -------------------------------------------------------------------------------- /build/make_etags: -------------------------------------------------------------------------------- 1 | search=".. ../.." 2 | for dir in $search; do 3 | if test -d "`pwd`/$dir/modperl-2.0"; then 4 | root="`pwd`/$dir" 5 | echo "root=$root" 6 | fi 7 | done 8 | 9 | #e.g. symlink to $HOME/perl/perl-current 10 | #XXX: perl has its own (more robust) TAGS generator: emacs/ptags 11 | perl_src=$root/perl/ 12 | #XXX: apache has its own: build/MakeEtags 13 | apache_src=$root/httpd-2.0/ 14 | modperl_src=$root/modperl-2.0/src/ 15 | xs_src=$root/modperl-2.0/xs 16 | 17 | cd $root/modperl-2.0 18 | rm -f src/modules/perl/etag_files 19 | 20 | for dir in $apache_src $modperl_src $perl_src $xs_src; do 21 | echo $dir 22 | find $dir -follow -name '*.[ch]' >> src/modules/perl/etag_files 23 | done 24 | 25 | (cd src/modules/perl && etags `cat etag_files`) 26 | 27 | rm -f src/modules/perl/etag_files 28 | -------------------------------------------------------------------------------- /build/source_scan.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | #requires C::Scan 0.75+ 3 | 4 | use lib qw(lib Apache-Test/lib); 5 | 6 | use strict; 7 | use Apache2::ParseSource (); 8 | use ModPerl::ParseSource (); 9 | use ModPerl::FunctionMap (); 10 | use ModPerl::WrapXS (); #XXX: we should not need to require this here 11 | 12 | my $p = Apache2::ParseSource->new(prefixes => ModPerl::FunctionMap->prefixes, 13 | @ARGV); 14 | 15 | $p->parse; 16 | 17 | $p->write_constants_pm; 18 | 19 | $p->write_functions_pm; 20 | 21 | $p->write_structs_pm; 22 | 23 | $p = ModPerl::ParseSource->new(@ARGV); 24 | 25 | $p->parse; 26 | 27 | $p->write_functions_pm; 28 | -------------------------------------------------------------------------------- /build/xs_generate.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use lib qw(lib Apache-Test/lib); 3 | 4 | use Apache::TestConfig (); # needed to resolve circular use dependency 5 | 6 | use ModPerl::WrapXS (); 7 | 8 | my $xs = ModPerl::WrapXS->new; 9 | 10 | $xs->generate; 11 | 12 | -------------------------------------------------------------------------------- /patches/c-scan.pat: -------------------------------------------------------------------------------- 1 | --- Scan.pm~ Thu Mar 23 06:14:18 2000 2 | +++ Scan.pm Sun Jan 7 11:56:04 2001 3 | @@ -400,7 +400,12 @@ 4 | } else { 5 | $vars = parse_vars($chunk); 6 | } 7 | - push @$struct, @$vars; 8 | + if ($vars) { 9 | + push @$struct, @$vars; 10 | + } 11 | + else { 12 | + warn "unable to parse chunk: `$chunk'" if $C::Scan::Warn; 13 | + } 14 | } 15 | $structs->{$structname} = $struct; 16 | $structname; 17 | -------------------------------------------------------------------------------- /src/modules/perl/modperl_common_debug.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* This file must not contain any symbols from apache/mod_perl 18 | * (apr and perl are OK) */ 19 | #include "modperl_common_includes.h" 20 | 21 | /* 22 | * Local Variables: 23 | * c-basic-offset: 4 24 | * indent-tabs-mode: nil 25 | * End: 26 | */ 27 | -------------------------------------------------------------------------------- /src/modules/perl/modperl_common_debug.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef MODPERL_COMMON_DEBUG_H 18 | #define MODPERL_COMMON_DEBUG_H 19 | 20 | 21 | #endif /* MODPERL_COMMON_DEBUG_H */ 22 | 23 | /* 24 | * Local Variables: 25 | * c-basic-offset: 4 26 | * indent-tabs-mode: nil 27 | * End: 28 | */ 29 | -------------------------------------------------------------------------------- /src/modules/perl/modperl_log.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "modperl_log.h" 18 | 19 | /* 20 | * Local Variables: 21 | * c-basic-offset: 4 22 | * indent-tabs-mode: nil 23 | * End: 24 | */ 25 | -------------------------------------------------------------------------------- /t/apache/add_config.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # the handler is configured in modperl_extra.pl via 3 | # Apache2::ServerUtil->server->add_config 4 | use Apache::TestRequest 'GET_BODY_ASSERT'; 5 | 6 | print GET_BODY_ASSERT "/apache/add_config"; 7 | -------------------------------------------------------------------------------- /t/apache/cgihandler.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 2; 10 | 11 | my $location = "/TestApache__cgihandler"; 12 | 13 | my $expected = "1..3\nok 1\nok 2\nok 3\n"; 14 | 15 | my $received = POST_BODY $location, content => $expected; 16 | 17 | ok t_cmp $received, $expected, "POST cgihandler"; 18 | 19 | $received = GET_BODY $location; 20 | 21 | ok t_cmp $received, $expected, "GET cgihandler"; 22 | -------------------------------------------------------------------------------- /t/apache/discard_rbody.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestUtil; 6 | use Apache::Test; 7 | use Apache::TestRequest; 8 | 9 | my $location = "/TestApache__discard_rbody"; 10 | my $content = "Y" x 100000; # more than one bucket 11 | 12 | plan tests => 3; 13 | 14 | for my $test (qw(none partial all)) { 15 | my $received = POST_BODY "$location?$test", content => $content; 16 | ok t_cmp($received, $test, "data consumption: $test"); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /t/apache/post.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 2; 10 | 11 | my $location = "/TestApache__post"; 12 | my $str; 13 | 14 | my @data = (arizona => 'wildcats'); 15 | my %data = @data; 16 | 17 | $str = POST_BODY $location, content => "@data"; 18 | 19 | ok $str; 20 | 21 | my $data = join '&', map { "$_=$data{$_}" } keys %data; 22 | 23 | $str = POST_BODY $location, content => $data; 24 | ok t_cmp($str, 25 | join(':', length($data), $data), 26 | "POST"); 27 | -------------------------------------------------------------------------------- /t/apache/read2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::TestRequest 'POST_BODY_ASSERT'; 3 | print POST_BODY_ASSERT "/TestApache__read2", 4 | content => "foobar"; 5 | -------------------------------------------------------------------------------- /t/apache/read3.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::TestRequest 'POST_BODY_ASSERT'; 3 | print POST_BODY_ASSERT "/TestApache__read3", 4 | content => "foobar"x2000; 5 | -------------------------------------------------------------------------------- /t/apache/read4.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::TestRequest 'POST_BODY_ASSERT'; 3 | print POST_BODY_ASSERT "/TestApache__read4", 4 | content => "foobar"x2; 5 | -------------------------------------------------------------------------------- /t/apache/scanhdrs.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 4; 10 | 11 | my $module = 'TestApache::scanhdrs'; 12 | my $location = "/" . Apache::TestRequest::module2path($module); 13 | 14 | my $res = GET $location; 15 | 16 | t_debug $res->as_string; 17 | 18 | ok t_cmp($res->content, qr/^ok 1$/m); 19 | 20 | ok t_cmp($res->header('Content-Type'), 21 | 'text/test-output', 22 | "standard header"); 23 | 24 | ok t_cmp($res->header('X-Perl-Module'), 25 | $module, 26 | "custom header"); 27 | 28 | ok t_cmp($res->message, qr/beer/); 29 | -------------------------------------------------------------------------------- /t/apache/scanhdrs2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 5, need 'HTML::HeadParser'; 10 | 11 | my $module = 'TestApache__scanhdrs2'; 12 | my $location = "/$module"; 13 | 14 | my $redirect = 'http://perl.apache.org/'; 15 | 16 | my $res = GET "$location?$redirect", redirect_ok => 0; 17 | 18 | ok t_cmp($res->header('Location')||'', $redirect, 19 | "Location header"); 20 | 21 | ok t_cmp($res->code, 302, 22 | "status == 302"); 23 | 24 | $redirect = '/index.html'; 25 | 26 | $res = GET "$location?$redirect", redirect_ok => 0; 27 | 28 | ok t_cmp(!$res->header('Location'), 1, 29 | "no Location header"); 30 | 31 | ok t_cmp($res->code, 200, 32 | "status == 200"); 33 | 34 | ok t_cmp($res->content, qr{welcome to}, 35 | "content is index.html"); 36 | -------------------------------------------------------------------------------- /t/apache/send_cgi_header.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 4; 10 | 11 | my $location = "/TestApache__send_cgi_header"; 12 | my $res = GET $location; 13 | 14 | ok t_cmp($res->header('X-Foo'), 15 | 'X-Bar', 16 | "header test"); 17 | 18 | ok t_cmp($res->header('Set-Cookie'), 19 | 'Bad Programmer, No cookie!', 20 | "header test2"); 21 | 22 | my $expected = "\0\0This not the end of the world\0\0\n"; 23 | my $received = $res->content; 24 | 25 | ok t_cmp(length($received), 26 | length($expected), 27 | "body length test"); 28 | 29 | # \000 aren't seen when printed 30 | ok t_cmp($received, 31 | $expected, 32 | "body content test"); 33 | -------------------------------------------------------------------------------- /t/api/access2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | if (!have_min_apache_version("2.4.0")) { 10 | 11 | plan tests => 6, need need_lwp, need_auth, need_access, 'mod_version.c', 12 | 'HTML::HeadParser'; 13 | 14 | my $location = "/TestAPI__access2"; 15 | 16 | ok !GET_OK $location; 17 | 18 | my $rc = GET_RC $location; 19 | ok t_cmp $rc, 401, "no credentials passed"; 20 | 21 | # bad user 22 | ok !GET_OK $location, username => 'root', password => '1234'; 23 | 24 | # good user/bad pass 25 | ok !GET_OK $location, username => 'goo', password => 'foo'; 26 | 27 | # good user/good pass 28 | ok GET_OK $location, username => 'goo', password => 'goopass'; 29 | 30 | # any user/any pass POST works 31 | ok POST_OK $location, username => 'bar', password => 'goopass1', 32 | content => "a"; 33 | 34 | } 35 | else { 36 | 37 | plan tests => 1, need {"mod_perl is not compiled with httpd-2.2" => 0}; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /t/api/access2_24.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings FATAL => 'all'; 3 | 4 | use Apache::Test; 5 | use Apache::TestUtil; 6 | use Apache::TestRequest; 7 | 8 | if (have_min_apache_version("2.4.0")) { 9 | 10 | plan tests => 6, need need_lwp, need_auth, need_access, 'mod_access_compat.c', 11 | 'mod_version.c', 'HTML::HeadParser'; 12 | 13 | my $location = "/TestAPI__access2"; 14 | 15 | ok !GET_OK $location; 16 | 17 | my $rc = GET_RC $location; 18 | ok t_cmp $rc, 401, "no credentials passed"; 19 | 20 | # bad user 21 | ok !GET_OK $location, username => 'root', password => '1234'; 22 | 23 | # good user/bad pass 24 | ok !GET_OK $location, username => 'goo', password => 'foo'; 25 | 26 | # good user/good pass 27 | ok GET_OK $location, username => 'goo', password => 'goopass'; 28 | 29 | # any user/any pass POST works 30 | ok POST_OK $location, username => 'bar', password => 'goopass1', 31 | content => "a"; 32 | 33 | } 34 | else { 35 | 36 | plan tests => 1, need {"mod_perl is not compiled with httpd-2.4" => 0}; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /t/api/add_config.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestAPI::add_config'; 10 | my $url = Apache::TestRequest::module2url($module) . "/"; 11 | 12 | t_debug("connecting to $url"); 13 | print GET_BODY_ASSERT $url; 14 | 15 | -------------------------------------------------------------------------------- /t/api/content_encoding.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1, need_min_module_version("Compress::Zlib", "1.09"); 10 | 11 | my $location = '/TestAPI__content_encoding'; 12 | 13 | my $expected = 'This is a clear text'; 14 | 15 | my $res = POST $location, content => $expected; 16 | 17 | my $received = $res->content; 18 | #t_debug($received); 19 | 20 | if ($res->header('Content-Encoding') =~ /gzip/) { 21 | require Compress::Zlib; 22 | 23 | # gzip already produces data in a network order, so no extra 24 | # transformation seem to be necessary 25 | $received = Compress::Zlib::memGunzip($received); 26 | } 27 | 28 | ok t_cmp $received, $expected, "Content-Encoding: gzip test"; 29 | 30 | -------------------------------------------------------------------------------- /t/api/in_out_filters.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestAPI__in_out_filters'; 12 | 13 | my $content = join '', 'AA'..'ZZ', 1..99999; 14 | 15 | my $expected = lc $content; 16 | my $received = POST_BODY $location, content => $content; 17 | 18 | # don't use t_cmp in this test, because the data length is 500K. 19 | # You don't want to see 500K * 2 when you run t/TEST -verbose 20 | 21 | ok $received eq $expected; 22 | 23 | -------------------------------------------------------------------------------- /t/api/internal_redirect.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | # test internal redirects originating from 'SetHandler modperl' and 6 | # 'SetHandler perl-script' main handlers, and sub-requests handled by 7 | # the handlers of the same and the opposite kind 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | use Apache::TestRequest; 12 | 13 | my $uri = "/TestAPI__internal_redirect"; 14 | 15 | my %map = ( 16 | "modperl => modperl" => "${uri}_modperl?uri=${uri}_modperl", 17 | "perl-script => modperl" => "${uri}_perl_script?uri=${uri}_modperl", 18 | "perl-script => perl-script" => "${uri}_perl_script?uri=${uri}_perl_script", 19 | "modperl => perl-script" => "${uri}_modperl?uri=${uri}_perl_script", 20 | ); 21 | 22 | plan tests => scalar keys %map; 23 | 24 | while (my ($key, $val) = each %map) { 25 | my $expected = "internal redirect: $key"; 26 | my $received = GET_BODY_ASSERT $val; 27 | ok t_cmp($received, $expected); 28 | } 29 | -------------------------------------------------------------------------------- /t/api/internal_redirect_handler.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $uri = "/TestAPI__internal_redirect_handler"; 10 | 11 | my @ct_types = qw(text/plain text/html); 12 | 13 | plan tests => scalar @ct_types; 14 | 15 | for my $type (@ct_types) { 16 | my $expected = $type; 17 | my $received = GET_BODY_ASSERT "$uri?ct=$type"; 18 | ok t_cmp $received, $expected, "Content-type: $type"; 19 | } 20 | -------------------------------------------------------------------------------- /t/api/lookup_misc.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | use File::Spec; 10 | 11 | my $uri = "/TestAPI__lookup_misc"; 12 | 13 | my $file = File::Spec->rel2abs(__FILE__); 14 | open my $fh, $file or die "Can't open $file: $!"; 15 | my $data = do { binmode $fh; local $/; <$fh> }; 16 | close $fh; 17 | 18 | plan tests => 2; 19 | 20 | # lookup_file 21 | { 22 | my $args = "subreq=lookup_file;file=$file"; 23 | my $expected = $data; 24 | my $received = GET_BODY_ASSERT "$uri?$args"; 25 | t_debug "lookup_file"; 26 | ok $received eq $expected; 27 | } 28 | 29 | # lookup_method_uri 30 | { 31 | my $args = "subreq=lookup_method_uri;uri=/lookup_method_uri"; 32 | my $expected = "ok"; 33 | my $received = GET_BODY_ASSERT "$uri?$args"; 34 | ok t_cmp $received, $expected, "lookup_method_uri"; 35 | } 36 | -------------------------------------------------------------------------------- /t/api/lookup_uri.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $uri = "/TestAPI__lookup_uri"; 10 | 11 | use constant PREFIX => 0; 12 | use constant SUFFIX => 1; 13 | 14 | my %opts = ( 15 | first => [2, 2], # all filters run twice 16 | second => [1, 2], # the top level req filter skipped for the subreq 17 | none => [1, 1], # no request filters run by subreq 18 | default => [1, 1], # same as none 19 | ); 20 | 21 | plan tests => scalar keys %opts; 22 | 23 | while (my ($filter, $runs) = each %opts) { 24 | my $args = "subreq=lookup_uri;filter=$filter"; 25 | my $prefix = "pre+" x $runs->[PREFIX]; 26 | my $suffix = "+suf" x $runs->[SUFFIX]; 27 | my $expected = "$prefix$args$suffix"; 28 | my $received = GET_BODY_ASSERT "$uri?$args"; 29 | ok t_cmp $received, $expected, "$args"; 30 | } 31 | -------------------------------------------------------------------------------- /t/api/request_rec.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest 'GET_BODY_ASSERT'; 6 | print GET_BODY_ASSERT "/TestAPI__request_rec/my_path_info?my_args=3"; 7 | -------------------------------------------------------------------------------- /t/api/rflush.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | my $location = '/TestAPI__rflush'; 10 | 11 | plan tests => 2; 12 | 13 | { 14 | my $response = GET_BODY "$location?nontied"; 15 | ok t_cmp($response, "[1][2][3][4][56]", 16 | "non-tied rflush creates bucket brigades"); 17 | } 18 | 19 | { 20 | my $response = GET_BODY "$location?tied"; 21 | ok t_cmp($response, "[1][2][3456]", 22 | "tied STDOUT internal rflush creates bucket brigades"); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /t/api/slurp_filename.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::TestRequest 'GET_BODY_ASSERT'; 3 | 4 | # we want r->filename to be "/slurp/slurp.pl", even though the 5 | # response handler is TestAPI::slurp_filename 6 | 7 | print GET_BODY_ASSERT "/slurp/slurp.pl"; 8 | -------------------------------------------------------------------------------- /t/apr-ext/base64.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::base64; 9 | 10 | plan tests => TestAPRlib::base64::num_of_tests(); 11 | 12 | TestAPRlib::base64::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/brigade.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::brigade; 9 | 10 | plan tests => TestAPRlib::brigade::num_of_tests(); 11 | 12 | TestAPRlib::brigade::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/bucket.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::bucket; 9 | 10 | plan tests => TestAPRlib::bucket::num_of_tests(); 11 | 12 | TestAPRlib::bucket::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/date.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::date; 9 | 10 | plan tests => TestAPRlib::date::num_of_tests(); 11 | 12 | TestAPRlib::date::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/error.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::error; 9 | 10 | plan tests => TestAPRlib::error::num_of_tests(); 11 | 12 | TestAPRlib::error::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/finfo.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::finfo; 9 | 10 | plan tests => TestAPRlib::finfo::num_of_tests(); 11 | 12 | TestAPRlib::finfo::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/os.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::os; 9 | 10 | plan tests => TestAPRlib::os::num_of_tests(); 11 | 12 | TestAPRlib::os::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/pool.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::pool; 9 | 10 | plan tests => TestAPRlib::pool::num_of_tests(); 11 | 12 | TestAPRlib::pool::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/status.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::status; 9 | 10 | plan tests => TestAPRlib::status::num_of_tests(); 11 | 12 | TestAPRlib::status::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/string.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::string; 9 | 10 | plan tests => TestAPRlib::string::num_of_tests(); 11 | 12 | TestAPRlib::string::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/table.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::table; 9 | 10 | plan tests => TestAPRlib::table::num_of_tests(); 11 | 12 | TestAPRlib::table::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/threadmutex.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::threadmutex; 9 | 10 | plan tests => TestAPRlib::threadmutex::num_of_tests(), need_threads; 11 | 12 | TestAPRlib::threadmutex::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/threadrwlock.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::threadrwlock; 9 | 10 | plan tests => TestAPRlib::threadrwlock::num_of_tests(), need_threads; 11 | 12 | TestAPRlib::threadrwlock::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/uri.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::uri; 9 | 10 | plan tests => TestAPRlib::uri::num_of_tests(); 11 | 12 | TestAPRlib::uri::test(); 13 | -------------------------------------------------------------------------------- /t/apr-ext/util.t: -------------------------------------------------------------------------------- 1 | #!perl -T 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | use Apache::Test; 7 | 8 | use TestAPRlib::util; 9 | 10 | plan tests => TestAPRlib::util::num_of_tests(); 11 | 12 | TestAPRlib::util::test(); 13 | -------------------------------------------------------------------------------- /t/apr/constants.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use ExtUtils::testlib; 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache::Test; 7 | 8 | use Apache::TestUtil; 9 | 10 | use APR::Const -compile => qw(:common POLLIN :filetype); 11 | use APR::Const qw(:hook); 12 | 13 | plan tests => 5; 14 | 15 | ok ! defined &POLLIN; 16 | ok t_cmp (APR::Const::SUCCESS, 0, 'APR::Const::SUCCESS'); 17 | ok t_cmp (APR::Const::POLLIN, 0x001, 'APR::Const::POLLIN'); 18 | ok t_cmp (HOOK_LAST, 20, 'HOOK_LAST'); 19 | ok t_cmp (APR::Const::FILETYPE_UNKFILE, 127, 'APR::UNKFILE'); 20 | -------------------------------------------------------------------------------- /t/apr/pool_lifetime.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | Apache::TestRequest::user_agent(keep_alive => 1); 9 | 10 | plan tests => 2, need 'HTML::HeadParser'; 11 | 12 | my $module = 'TestAPR::pool_lifetime'; 13 | my $location = '/' . Apache::TestRequest::module2path($module); 14 | 15 | for (1..2) { 16 | my $expected = "Pong"; 17 | my $received = GET $location; 18 | 19 | ok t_cmp( 20 | $received->content, 21 | $expected, 22 | "Pong", 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /t/compat/conn_authen.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 1, need need_lwp, need_auth, 'HTML::HeadParser'; 9 | 10 | my $location = "/TestCompat__conn_authen"; 11 | 12 | ok GET_OK $location, username => 'dougm', password => 'foo'; 13 | 14 | -------------------------------------------------------------------------------- /t/compat/send_fd.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | use File::Spec::Functions qw(catfile); 9 | 10 | plan tests => 3, need 'HTML::HeadParser'; 11 | 12 | my $config = Apache::Test::config(); 13 | 14 | my $url = '/TestCompat__send_fd'; 15 | 16 | my $data = GET_BODY($url); 17 | 18 | ok $data; 19 | 20 | my $module = catfile Apache::Test::vars('serverroot'), 21 | 'response/TestCompat/send_fd.pm'; 22 | 23 | ok length($data) == -s $module; 24 | 25 | $data = GET_BODY("$url?noexist.txt"); 26 | 27 | ok $data =~ /Not Found/; 28 | -------------------------------------------------------------------------------- /t/directive/perl.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 8, need need_auth, 'mod_alias.c', 'HTML::HeadParser'; 9 | 10 | #so we don't have to require lwp 11 | my @auth = (Authorization => 'Basic ZG91Z206Zm9v'); #dougm:foo 12 | 13 | 14 | foreach my $location ("/perl_sections/index.html", 15 | "/perl_sections_readconfig/index.html") { 16 | 17 | sok { 18 | ! GET_OK $location; 19 | }; 20 | 21 | sok { 22 | my $rc = GET_RC $location; 23 | $rc == 401; 24 | }; 25 | 26 | sok { 27 | GET_OK $location, @auth; 28 | }; 29 | 30 | sok { 31 | ! GET_OK $location, $auth[0], $auth[1] . 'bogus'; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /t/directive/perlcleanuphandler.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest 'GET_BODY'; 8 | 9 | plan tests => 3, need_lwp; 10 | 11 | my $module = 'TestDirective::perlcleanuphandler'; 12 | 13 | Apache::TestRequest::user_agent(reset => 1, keep_alive=>1); 14 | sub u {Apache::TestRequest::module2url($module, {path=>$_[0]})} 15 | 16 | t_debug("connecting to ".u('')); 17 | ok t_cmp GET_BODY(u('/get?incr')), 'UNDEF', 'before increment'; 18 | ok t_cmp GET_BODY(u('/get')), '1', 'incremented'; 19 | (undef)=GET_BODY(u('/index.html?incr')); 20 | ok t_cmp GET_BODY(u('/get')), '2', 'incremented again'; 21 | -------------------------------------------------------------------------------- /t/directive/perlloadmodule2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $url = "/TestDirective__perlloadmodule2"; 10 | 11 | plan tests => 3; 12 | 13 | { 14 | my $location = "$url?srv"; 15 | my $expected = "srv: one two"; 16 | my $received = GET_BODY $location; 17 | ok t_cmp($received, $expected, "access server settings"); 18 | } 19 | 20 | { 21 | my $location = "$url?"; 22 | my $expected = "dir: one two three four"; 23 | my $received = GET_BODY $location; 24 | ok t_cmp($received, $expected, "server/dir merge"); 25 | } 26 | 27 | { 28 | my $location = "$url/subdir"; 29 | my $expected = "dir: one two three four five six"; 30 | my $received = GET_BODY $location; 31 | ok t_cmp($received, $expected, "server/dir/subdir merge"); 32 | } 33 | -------------------------------------------------------------------------------- /t/directive/perlloadmodule4.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest; 6 | use Apache::Test; 7 | 8 | my $module = "TestDirective::perlloadmodule4"; 9 | my $config = Apache::Test::config(); 10 | Apache::TestRequest::module($module); 11 | my $hostport = Apache::TestRequest::hostport($config); 12 | my $path = Apache::TestRequest::module2path($module); 13 | 14 | print GET_BODY_ASSERT "http://$hostport/$path"; 15 | -------------------------------------------------------------------------------- /t/directive/perlloadmodule5.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest; 6 | use Apache::Test; 7 | 8 | my $module = "TestDirective::perlloadmodule5"; 9 | my $config = Apache::Test::config(); 10 | Apache::TestRequest::module($module); 11 | my $hostport = Apache::TestRequest::hostport($config); 12 | my $path = Apache::TestRequest::module2path($module); 13 | 14 | print GET_BODY_ASSERT "http://$hostport/$path"; 15 | -------------------------------------------------------------------------------- /t/directive/perlloadmodule6.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest; 6 | use Apache::Test; 7 | 8 | my $module = "TestDirective::perlloadmodule6"; 9 | my $config = Apache::Test::config(); 10 | Apache::TestRequest::module($module); 11 | my $hostport = Apache::TestRequest::hostport($config); 12 | my $path = Apache::TestRequest::module2path($module); 13 | 14 | print GET_BODY_ASSERT "http://$hostport/$path"; 15 | -------------------------------------------------------------------------------- /t/directive/perlmodule.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # this test tests PerlRequire configuration directive 3 | ######################################################################## 4 | 5 | use strict; 6 | use warnings FATAL => 'all'; 7 | 8 | use Apache::Test; 9 | use Apache::TestUtil; 10 | use Apache::TestRequest; 11 | 12 | my $module = 'TestDirective::perlmodule'; 13 | 14 | plan tests => 1; 15 | 16 | Apache::TestRequest::module($module); 17 | 18 | my $config = Apache::Test::config(); 19 | my $hostport = Apache::TestRequest::hostport($config); 20 | my $path = Apache::TestRequest::module2path($module); 21 | t_debug("connecting to $hostport"); 22 | 23 | ok t_cmp(GET_BODY("/$path"), 24 | $module, 25 | "testing PerlModule in $module"); 26 | 27 | -------------------------------------------------------------------------------- /t/error/syntax.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = "/TestError__syntax"; 12 | 13 | t_client_log_error_is_expected(); 14 | my $res = GET($location); 15 | #t_debug($res->content); 16 | ok t_cmp( 17 | $res->code, 18 | 500, 19 | "500 error on syntax error", 20 | ); 21 | -------------------------------------------------------------------------------- /t/filter/TestFilter/out_str_lc.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestFilter::out_str_lc; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::Filter (); 8 | 9 | use TestCommon::Utils; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $filter = shift; 15 | 16 | while ($filter->read(my $buffer, 1024)) { 17 | 18 | # test that read() returns tainted data 19 | die "read() has returned untainted data" 20 | unless TestCommon::Utils::is_tainted($buffer); 21 | 22 | $filter->print(lc $buffer); 23 | } 24 | 25 | Apache2::Const::OK; 26 | } 27 | 28 | 1; 29 | __DATA__ 30 | 31 | 32 | PerlOutputFilterHandler TestFilter::out_str_lc 33 | 34 | 35 | Alias /top_dir @top_dir@ 36 | 37 | -------------------------------------------------------------------------------- /t/filter/TestFilter/with_subrequest.pm: -------------------------------------------------------------------------------- 1 | package TestFilter::with_subrequest; 2 | 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache2::Filter (); 7 | use Apache2::SubRequest (); 8 | 9 | use TestCommon::Utils; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $f = shift; 15 | my $r = $f->r; 16 | 17 | my $subr; 18 | while ($f->read(my $buffer, 1024)) { 19 | $f->print(lc $buffer); 20 | if (!$subr) { 21 | $subr = $r->lookup_uri($r->uri); 22 | my $rc = $subr->run; 23 | } 24 | } 25 | 26 | Apache2::Const::OK; 27 | } 28 | 29 | 1; 30 | __DATA__ 31 | 32 | 33 | PerlOutputFilterHandler TestFilter::with_subrequest 34 | 35 | 36 | 37 | Alias /with_subrequest @top_dir@ 38 | 39 | -------------------------------------------------------------------------------- /t/filter/both_str_con_add.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(MODPERL 2.0 RULES); 10 | 11 | # blocking socket bug fixed in 2.0.52 12 | my $ok = $^O !~ /^(Open|Net)BSD$/i || need_min_apache_version('2.0.52'); 13 | 14 | plan tests => 1 + @test_strings, $ok; 15 | 16 | my $module = "TestFilter::both_str_con_add"; 17 | my $socket = Apache::TestRequest::vhost_socket($module); 18 | 19 | ok $socket; 20 | 21 | for my $str (@test_strings) { 22 | print $socket "$str\n"; 23 | chomp(my $reply = <$socket>||''); 24 | $str = lc $str; 25 | $str =~ s/modperl/mod_perl/; 26 | ok t_cmp($reply, $str); 27 | } 28 | -------------------------------------------------------------------------------- /t/filter/both_str_req_add.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $data = join ' ', 'A'..'Z', 0..9; 12 | my $expected = lc $data; # that's what the input filter does 13 | $expected =~ s/\s+//g; # that's what the output filter does 14 | $expected .= "end"; # that's what the anon output filter does 15 | my $location = '/TestFilter__both_str_req_add'; 16 | my $response = POST_BODY $location, content => $data; 17 | ok t_cmp($response, $expected, "lc input and reverse output filters"); 18 | 19 | -------------------------------------------------------------------------------- /t/filter/both_str_req_proxy.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | my @modules = qw(mod_proxy proxy_http.c); 10 | push @modules, 'mod_access_compat.c' if have_min_apache_version("2.4.0"); 11 | plan tests => 1, need need_module(@modules), need_access; 12 | 13 | my $data = join ' ', 'A'..'Z', 0..9; 14 | my $expected = lc $data; # that's what the input filter does 15 | $expected =~ s/\s+//g; # that's what the output filter does 16 | my $location = '/TestFilter__both_str_req_proxy/foo'; 17 | my $response = POST_BODY $location, content => $data; 18 | ok t_cmp($response, $expected, "lc input and reverse output filters"); 19 | 20 | -------------------------------------------------------------------------------- /t/filter/in_autoload.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_autoload'; 12 | 13 | my $data = "[Foo BaR] "; 14 | my $expected = lc $data; 15 | my $received = POST_BODY $location, content => $data; 16 | 17 | ok t_cmp($received, $expected, "input stream filter lc autoloaded") 18 | 19 | -------------------------------------------------------------------------------- /t/filter/in_bbs_body.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest; 6 | 7 | my $location = '/TestFilter__in_bbs_body'; 8 | 9 | print GET_BODY_ASSERT $location; 10 | 11 | for my $x (2..3) { 12 | my $data = scalar reverse "ok $x\n"; 13 | print POST_BODY_ASSERT $location, content => $data; 14 | } 15 | -------------------------------------------------------------------------------- /t/filter/in_bbs_consume.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_bbs_consume'; 12 | 13 | # send a message bigger than 8k, so to make sure that the input filter 14 | # will get more than one bucket brigade with data. 15 | my $length = 40 * 1024 + 7; # ~40k+ (~6 incoming bucket brigades) 16 | my $expected = join '', 'a'..'z'; 17 | my $data = $expected . "x" x $length; 18 | my $received = POST_BODY $location, content => $data; 19 | 20 | ok t_cmp($received, $expected, "input bbs filter full consume") 21 | -------------------------------------------------------------------------------- /t/filter/in_bbs_msg.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::Test (); 3 | use Apache::TestUtil; 4 | 5 | use Apache::TestRequest 'GET_BODY_ASSERT'; 6 | 7 | my $module = 'TestFilter::in_bbs_msg'; 8 | 9 | Apache::TestRequest::scheme('http'); #force http for t/TEST -ssl 10 | Apache::TestRequest::module($module); 11 | 12 | my $config = Apache::Test::config(); 13 | my $hostport = Apache::TestRequest::hostport($config); 14 | t_debug("connecting to $hostport"); 15 | 16 | print GET_BODY_ASSERT "/input_filter.html"; 17 | -------------------------------------------------------------------------------- /t/filter/in_bbs_underrun.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_bbs_underrun'; 12 | 13 | # send a message of about 40k, so to make sure that the input filter 14 | # will get several bucket brigades with data (about 8k/brigade) 15 | my $length = 40 * 1024 + 7; # ~40k+ (~6 incoming bucket brigades) 16 | my $data = "x" x $length; 17 | my $received = POST_BODY $location, content => $data; 18 | my $expected = "read $length chars"; 19 | 20 | ok t_cmp($received, $expected, "input bbs filter underrun test") 21 | -------------------------------------------------------------------------------- /t/filter/in_error.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_error'; 12 | 13 | my $res = POST $location, content => 'foo'; 14 | ok t_cmp($res->code, 500, "an error in a filter should cause 500"); 15 | 16 | -------------------------------------------------------------------------------- /t/filter/in_init_basic.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $content = "content ok\n"; 12 | # older httpds may run the input request filter twice 13 | my $expected = join '', $content, "init 1\n", "run [12]\n"; 14 | 15 | my $location = '/TestFilter__in_init_basic'; 16 | my $response = POST_BODY $location, content => $content; 17 | ok t_cmp($response, qr/$expected/, "test filter init functionality"); 18 | -------------------------------------------------------------------------------- /t/filter/in_str_bin_data.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 4; 10 | 11 | my $base = "/TestFilter__in_str_bin_data"; 12 | my @locations = map {$base . $_ } ('', '_filter'); 13 | my $expected = "123\001456\000789"; 14 | 15 | # test the binary data read/print w/ and w/o pass through filter 16 | for my $location (@locations) { 17 | my $received = POST_BODY_ASSERT $location, content => $expected; 18 | 19 | ok t_cmp(length($received), 20 | length($expected), 21 | "$location binary response length"); 22 | 23 | ok t_cmp($received, 24 | $expected, 25 | "$location binary response data"); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /t/filter/in_str_consume.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | # see the explanations in in_str_consume.pm 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | use Apache::TestRequest; 10 | 11 | plan tests => 1; 12 | 13 | my $location = '/TestFilter__in_str_consume'; 14 | 15 | my $data = "*" x 80000; # about 78K => ~10 bbs 16 | my $expected = 105; 17 | 18 | t_debug "sent " . length($data) . "B, expecting ${expected}B to make through"; 19 | 20 | my $received = POST_BODY $location, content => $data; 21 | 22 | ok t_cmp($received, $expected, "input stream filter partial consume") 23 | -------------------------------------------------------------------------------- /t/filter/in_str_declined.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest 'POST_BODY_ASSERT';; 6 | 7 | my $location = '/TestFilter__in_str_declined'; 8 | 9 | my $chunk = "1234567890"; 10 | my $data = $chunk x 2000; 11 | 12 | print POST_BODY_ASSERT $location, content => $data; 13 | -------------------------------------------------------------------------------- /t/filter/in_str_declined_read.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest 'POST_BODY_ASSERT';; 6 | 7 | my $location = '/TestFilter__in_str_declined_read'; 8 | 9 | my $chunk = "1234567890"; 10 | my $data = $chunk x 2000; 11 | 12 | print POST_BODY_ASSERT $location, content => $data; 13 | -------------------------------------------------------------------------------- /t/filter/in_str_lc.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_str_lc'; 12 | 13 | my $chunk = "[Foo BaR] "; 14 | my $data = $chunk x 250; 15 | my $expected = lc $data; 16 | my $received = POST_BODY $location, content => $data; 17 | 18 | ok t_cmp($received, $expected, "input stream filter lc") 19 | 20 | -------------------------------------------------------------------------------- /t/filter/in_str_msg.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::Test (); 3 | use Apache::TestUtil; 4 | 5 | use Apache::TestRequest 'POST_BODY_ASSERT'; 6 | 7 | my $module = 'TestFilter::in_str_msg'; 8 | 9 | Apache::TestRequest::scheme('http'); #force http for t/TEST -ssl 10 | Apache::TestRequest::module($module); 11 | 12 | my $config = Apache::Test::config(); 13 | my $hostport = Apache::TestRequest::hostport($config); 14 | t_debug("connecting to $hostport"); 15 | 16 | print POST_BODY_ASSERT "/input_filter.html", content => "upcase me"; 17 | -------------------------------------------------------------------------------- /t/filter/in_str_sandwich.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__in_str_sandwich'; 12 | 13 | my $expected = join "\n", qw(HEADER BODY TAIL), ''; 14 | my $received = POST_BODY $location, content => "BODY\n"; 15 | 16 | ok t_cmp($received, $expected, "input stream filter sandwich") 17 | 18 | -------------------------------------------------------------------------------- /t/filter/out_bbs_ctx.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $blocks = 33; 12 | my $invoked = 34; # 33 bb made of data and 1 flush bucket (unbuffered print) 13 | # 1 bb with EOS bucket 14 | my $sig = join "\n", "received $blocks complete blocks", 15 | "filter invoked $invoked times\n"; 16 | my $data = "#" x $blocks . "x" x $blocks; 17 | my $expected = join "\n", $data, $sig; 18 | 19 | { 20 | # test the filtering of the mod_perl response handler 21 | my $location = '/TestFilter__out_bbs_ctx'; 22 | my $response = GET_BODY $location; 23 | ok t_cmp($response, $expected, "context filter"); 24 | } 25 | -------------------------------------------------------------------------------- /t/filter/out_init_basic.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $content = "content ok\n"; 12 | my $expected = join '', "init 1\n", "run 1\n", $content, "run 2\n"; 13 | # newer Apache versions may make yet another call, so you will see 14 | # "run 3\n" as well. 15 | 16 | my $location = '/TestFilter__out_init_basic'; 17 | my $response = POST_BODY $location, content => $content; 18 | ok t_cmp($response, qr/^$expected/, "test filter init functionality"); 19 | -------------------------------------------------------------------------------- /t/filter/out_str_buffer.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 2; 10 | 11 | my $sep = "-0-"; 12 | my $data = join $sep, "aa" .. "zz"; 13 | 14 | (my $expected = $data) =~ s/$sep//g; 15 | my $expected_len = length $expected; 16 | 17 | my $location = '/TestFilter__out_str_buffer'; 18 | my $res = POST $location, content => $data; 19 | #t_debug $res->as_string; 20 | my $received_len = $res->header('Content-Length') || 0; 21 | ok t_cmp $received_len, $expected_len, "Content-Length header"; 22 | ok t_cmp $res->content, $expected, "filtered data"; 23 | 24 | -------------------------------------------------------------------------------- /t/filter/out_str_ctx.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $blocks = 33; 12 | my $invoked = 67; # 33 bb made of data and 1 flush bucket (unbuffered print) 13 | # 33 bb made of 1 flush bucket (rflush) 14 | # 1 bb with EOS bucket 15 | my $sig = join "\n", "received $blocks complete blocks", 16 | "filter invoked $invoked times\n"; 17 | my $data = "#" x $blocks . "x" x $blocks; 18 | my $expected = join "\n", $data, $sig; 19 | 20 | { 21 | # test the filtering of the mod_perl response handler 22 | my $location = '/TestFilter__out_str_ctx'; 23 | my $response = GET_BODY $location; 24 | ok t_cmp($response, $expected, "context stream filter"); 25 | } 26 | -------------------------------------------------------------------------------- /t/filter/out_str_declined.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $expected = 11; # 10 flushes and 1 EOS bb 12 | 13 | my $location = '/TestFilter__out_str_declined'; 14 | my $response = GET_BODY $location; 15 | ok t_cmp($response, $expected, "an output filter handler returning DECLINED"); 16 | 17 | -------------------------------------------------------------------------------- /t/filter/out_str_lc.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 1, need 'mod_alias'; 9 | 10 | my $location = "/top_dir/Makefile"; 11 | 12 | my $str = GET_BODY $location; 13 | 14 | ok $str !~ /[A-Z]/; 15 | -------------------------------------------------------------------------------- /t/filter/out_str_remove.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $expected = "F_O_O_b_a_r_"; 12 | my $location = '/TestFilter__out_str_remove'; 13 | my $response = GET_BODY $location; 14 | ok t_cmp($response, $expected, "a filter that removes itself"); 15 | 16 | -------------------------------------------------------------------------------- /t/filter/out_str_req_eos.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1, ['include']; 10 | 11 | my $location = '/TestFilter__out_str_req_eos'; 12 | 13 | my $content = 'BODY'; 14 | my $prefix = 'PREFIX_'; 15 | my $suffix = '_SUFFIX'; 16 | 17 | my $expected = join '', $prefix, $content, $suffix; 18 | my $received = POST_BODY $location, content => $content; 19 | 20 | ok t_cmp($received, $expected, 21 | "testing the EOS bucket forwarding through the mp filters chains"); 22 | -------------------------------------------------------------------------------- /t/filter/out_str_req_mix.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1, ['include']; 10 | 11 | my $location = '/TestFilter__out_str_req_mix'; 12 | 13 | my $content = ''; 14 | 15 | my $expected = 'This is a clear text'; 16 | my $received = POST_BODY $location, content => $content; 17 | $received =~ s{\r?\n$}{}; 18 | 19 | ok t_cmp($expected, $received, 20 | "mixing output httpd and mod_perl filters, while preserving order"); 21 | -------------------------------------------------------------------------------- /t/filter/out_str_subreq_default.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | use Apache::TestConfig (); 9 | 10 | plan tests => 1, need 'mod_alias'; 11 | 12 | my $location = '/TestFilter__out_str_subreq_default'; 13 | 14 | my $content1 = "content\n"; 15 | my $content2 = "more content\n"; 16 | my $filter = "filter\n"; 17 | my $subrequest = "default-handler subrequest\n"; 18 | 19 | my $expected = join '', $content1, $subrequest, $content2, $filter; 20 | my $received = GET_BODY $location; 21 | # Win32 and Cygwin fix for line endings 22 | $received =~ s{\r}{}g if Apache::TestConfig::WIN32 || Apache::TestConfig::CYGWIN; 23 | 24 | ok t_cmp($received, $expected, 25 | "testing filter-originated lookup_uri() call to core served URI"); 26 | -------------------------------------------------------------------------------- /t/filter/out_str_subreq_modperl.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1; 10 | 11 | my $location = '/TestFilter__out_str_subreq_modperl'; 12 | 13 | my $content1 = "content\n"; 14 | my $content2 = "more content\n"; 15 | my $filter = "filter\n"; 16 | my $subrequest = "modperl subrequest\n"; 17 | 18 | my $expected = join '', $content1, $subrequest, $content2, $filter; 19 | my $received = GET_BODY $location; 20 | 21 | ok t_cmp($received, $expected, 22 | "testing filter-originated lookup_uri() call to modperl-served URI"); 23 | -------------------------------------------------------------------------------- /t/filter/with_subrequest.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings FATAL => 'all'; 3 | 4 | use Apache::Test; 5 | use Apache::TestRequest; 6 | 7 | plan tests => 1, need 'mod_alias'; 8 | 9 | my $location = "/with_subrequest/Makefile"; 10 | 11 | my $str = GET_BODY $location; 12 | 13 | ok $str !~ /[A-Z]/; 14 | -------------------------------------------------------------------------------- /t/hooks/TestHooks/fixup.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestHooks::fixup; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use APR::Table (); 10 | use Apache2::RequestRec (); 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | $r->notes->set(ok => 1); 18 | 19 | Apache2::Const::OK; 20 | } 21 | 22 | sub response { 23 | my $r = shift; 24 | 25 | plan $r, tests => 1; 26 | 27 | ok $r->notes->get('ok'); 28 | 29 | Apache2::Const::OK; 30 | } 31 | 32 | 1; 33 | __DATA__ 34 | PerlResponseHandler TestHooks::fixup::response 35 | SetHandler modperl 36 | -------------------------------------------------------------------------------- /t/hooks/TestHooks/headerparser.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestHooks::headerparser; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use APR::Table (); 10 | use Apache2::RequestRec (); 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | $r->notes->set(headerparser => 'set'); 18 | 19 | Apache2::Const::OK; 20 | } 21 | 22 | sub response { 23 | my $r = shift; 24 | 25 | plan $r, tests => 1; 26 | 27 | ok $r->notes->get('headerparser') eq 'set'; 28 | 29 | Apache2::Const::OK; 30 | } 31 | 32 | 1; 33 | __DATA__ 34 | PerlOptions +SetupEnv 35 | PerlResponseHandler TestHooks::headerparser::response 36 | SetHandler modperl 37 | -------------------------------------------------------------------------------- /t/hooks/TestHooks/inlined_handlers.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestHooks::inlined_handlers; 3 | 4 | # this test exercises httpd.conf inlined one-liner handlers, like: 5 | # PerlFixupHandler 'sub { use Apache2::Const qw(DECLINED); DECLINED }' 6 | # previously there was a bug in non-ithreaded-perl implementation 7 | # where the cached compiled CODE ref didn't have the reference count 8 | # right. 9 | 10 | use strict; 11 | use warnings FATAL => 'all'; 12 | 13 | use Apache2::RequestIO (); 14 | 15 | use Apache2::Const -compile => 'OK'; 16 | 17 | sub handler { 18 | my $r = shift; 19 | 20 | $r->print('ok'); 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | __DATA__ 27 | 28 | 29 | SetHandler modperl 30 | PerlFixupHandler 'sub { use Apache2::Const qw(DECLINED); DECLINED }' 31 | PerlResponseHandler TestHooks::inlined_handlers 32 | 33 | 34 | -------------------------------------------------------------------------------- /t/hooks/access.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 4, need 'HTML::HeadParser'; 9 | 10 | my $location = "/TestHooks__access"; 11 | 12 | ok ! GET_OK $location; 13 | 14 | my $rc = GET_RC $location; 15 | 16 | ok $rc == 403; 17 | 18 | ok GET_OK $location, 'X-Forwarded-For' => '127.0.0.1'; 19 | 20 | ok ! GET_OK $location, 'X-Forwarded-For' => '666.0.0.1'; 21 | 22 | 23 | -------------------------------------------------------------------------------- /t/hooks/authen_basic.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 4, need need_lwp, need_auth, 'HTML::HeadParser'; 9 | 10 | my $location = "/TestHooks__authen_basic"; 11 | 12 | sok { 13 | ! GET_OK $location; 14 | }; 15 | 16 | sok { 17 | my $rc = GET_RC $location; 18 | $rc == 401; 19 | }; 20 | 21 | sok { 22 | GET_OK $location, username => 'dougm', password => 'foo'; 23 | }; 24 | 25 | # since LWP 5.815, the user agent retains credentials 26 | # tell Apache::TestRequest to reinitialize its global agent 27 | Apache::TestRequest::user_agent(reset => 1); 28 | 29 | sok { 30 | ! GET_OK $location, username => 'dougm', password => 'wrong'; 31 | }; 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /t/hooks/authz.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | 8 | plan tests => 4, need need_lwp, 'HTML::HeadParser'; 9 | 10 | my $location = "/TestHooks__authz"; 11 | 12 | ok ! GET_OK $location; 13 | 14 | my $rc = GET_RC $location; 15 | 16 | ok $rc == 401; 17 | 18 | ok GET_OK $location, username => 'dougm', password => 'foo'; 19 | 20 | # since LWP 5.815, the user agent retains credentials 21 | # tell Apache::TestRequest to reinitialize its global agent 22 | Apache::TestRequest::user_agent(reset => 1); 23 | 24 | ok ! GET_OK $location, username => 'jobbob', password => 'whatever'; 25 | 26 | 27 | -------------------------------------------------------------------------------- /t/hooks/error.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 2; 10 | 11 | { 12 | my $location = "/TestHooks__error"; 13 | my $expected = qr/^Error: Undefined subroutine/; 14 | my $received = GET_BODY $location; 15 | ok t_cmp($received, $expected, "error-notes set on ErrorDocument"); 16 | } 17 | 18 | { 19 | my $error_seed_text = 'seed_text'; 20 | my $location = "/TestHooks__error?$error_seed_text"; 21 | my $expected = qr/^Error: \Q$error_seed_text\E, Undefined subroutine/; 22 | my $received = GET_BODY $location; 23 | ok t_cmp($received, $expected, "seeded error-notes set on ErrorDocument"); 24 | } 25 | -------------------------------------------------------------------------------- /t/hooks/hookrun.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $module = 'TestHooks::hookrun'; 10 | my $config = Apache::Test::config(); 11 | my $path = Apache::TestRequest::module2path($module); 12 | 13 | Apache::TestRequest::module($module); 14 | my $hostport = Apache::TestRequest::hostport($config); 15 | t_debug("connecting to $hostport"); 16 | 17 | plan tests => 10; 18 | 19 | my $ret = GET "http://$hostport/$path?die"; 20 | ok t_cmp $ret->code, 500, '$r->die'; 21 | 22 | my $body = GET_BODY_ASSERT "http://$hostport/$path?normal"; 23 | for my $line (split /\n/, $body) { 24 | my ($phase, $value) = split /:/, $line; 25 | ok t_cmp $value, 1, "$phase"; 26 | } 27 | -------------------------------------------------------------------------------- /t/hooks/init.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestHooks::init'; 10 | 11 | Apache::TestRequest::module($module); 12 | my $path = Apache::TestRequest::module2path($module); 13 | my $config = Apache::Test::config(); 14 | my $hostport = Apache::TestRequest::hostport($config); 15 | t_debug("connecting to $hostport"); 16 | 17 | print GET_BODY_ASSERT "http://$hostport/$path"; 18 | -------------------------------------------------------------------------------- /t/hooks/inlined_handlers.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | use TestCommon::SameInterp; 9 | 10 | plan tests => 2, need 'HTML::HeadParser'; 11 | 12 | my $location = "/TestHooks__inlined_handlers"; 13 | 14 | my $expected = "ok"; 15 | for (1..2) { 16 | my $received = GET $location; 17 | 18 | ok t_cmp( 19 | $received->content, 20 | $expected, 21 | "anonymous handlers in httpd.conf test", 22 | ); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /t/hooks/push_handlers.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my @refs = qw(conf conf1 conf2 coderef 12 | full_coderef coderef1 coderef2 coderef3); 13 | my @anon = qw(anonymous anonymous1 coderef4 anonymous3); 14 | 15 | my @strings = (@refs, @anon); 16 | 17 | my $location = "/TestHooks__push_handlers"; 18 | my $expected = join "\n", @strings, ''; 19 | my $received = GET_BODY $location; 20 | 21 | ok t_cmp($received, $expected, "push_handlers ways"); 22 | -------------------------------------------------------------------------------- /t/hooks/push_handlers_anon.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # the handler is configured in modperl_extra.pl via 3 | # Apache2::ServerUtil->server->add_config 4 | 5 | use Apache::TestUtil; 6 | use Apache::TestRequest 'GET_BODY_ASSERT'; 7 | 8 | my $module = 'TestHooks::push_handlers_anon'; 9 | my $url = Apache::TestRequest::module2url($module); 10 | 11 | t_debug("connecting to $url"); 12 | print GET_BODY_ASSERT $url; 13 | -------------------------------------------------------------------------------- /t/hooks/stacked_handlers.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1; 10 | 11 | my $location = "/TestHooks__stacked_handlers"; 12 | my $expected = join "\n", qw(one two three), ''; 13 | my $received = GET_BODY $location; 14 | 15 | ok t_cmp($received, $expected, "stacked_handlers"); 16 | -------------------------------------------------------------------------------- /t/hooks/startup.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | use Apache::TestRequest; 9 | 10 | my $config = Apache::Test::config(); 11 | my $path = Apache::TestRequest::module2path('TestHooks::startup'); 12 | 13 | my @modules = qw(default TestHooks::startup); 14 | 15 | plan tests => scalar @modules; 16 | 17 | my $expected = join '', "open_logs ok\n", "post_config ok\n"; 18 | 19 | for my $module (sort @modules) { 20 | 21 | Apache::TestRequest::module($module); 22 | my $hostport = Apache::TestRequest::hostport($config); 23 | t_debug("connecting to $hostport"); 24 | 25 | ok t_cmp(GET_BODY_ASSERT("http://$hostport/$path"), 26 | $expected, 27 | "testing PostConfig"); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /t/hooks/trans.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | use Apache2::Const ':common'; 10 | 11 | my $module = 'TestHooks::trans'; 12 | Apache::TestRequest::module($module); 13 | my $path = Apache::TestRequest::module2path($module); 14 | my $config = Apache::Test::config(); 15 | my $hostport = Apache::TestRequest::hostport($config); 16 | t_debug("connecting to $hostport"); 17 | 18 | plan tests => 3, need 'HTML::HeadParser'; 19 | 20 | t_client_log_error_is_expected(); 21 | ok t_cmp GET_RC("http://$hostport/nope"), NOT_FOUND; 22 | 23 | my $body = GET_BODY "http://$hostport/TestHooks/trans.pm"; 24 | 25 | ok $body =~ /package $module/; 26 | 27 | ok GET_OK "http://$hostport/phooey"; 28 | -------------------------------------------------------------------------------- /t/htdocs/TestAPI__add_config/htaccess: -------------------------------------------------------------------------------- 1 | TestAddConfig Htaccess 2 | -------------------------------------------------------------------------------- /t/htdocs/api/auth-groups: -------------------------------------------------------------------------------- 1 | bar: goo bar 2 | tar: mar far 3 | -------------------------------------------------------------------------------- /t/htdocs/api/auth-users: -------------------------------------------------------------------------------- 1 | goo:$apr1$g.mxW/..$p8ILT9D4345OO6vtYt8mT0 2 | bar:$apr1$ALRiO/..$GxXWAshiDKPmFGUA7r66e/ 3 | -------------------------------------------------------------------------------- /t/htdocs/api/custom_response.txt: -------------------------------------------------------------------------------- 1 | This is a custom file/url response 2 | -------------------------------------------------------------------------------- /t/htdocs/api/slurp.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | my $z = <new; 6 | 7 | print $cgi->header; 8 | 9 | print "cgi.pm\n"; 10 | 11 | __END__ 12 | -------------------------------------------------------------------------------- /t/htdocs/includes-registry/test.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | print "Content-type: text/html\n\n"; 3 | 4 | print "Hello World
\n"; 5 | -------------------------------------------------------------------------------- /t/htdocs/includes-registry/test.spl: -------------------------------------------------------------------------------- 1 | use strict; 2 | 3 | #XXX: this test needs to be more robust. 4 | #various output buffers spread across multiple prints 5 | #more mod_include features mixed and checking that the output 6 | #is *exactly* what we expected, not just matching a few patterns. 7 | 8 | print "Content-type: text/html\n\n"; 9 | 10 | my $r = shift; 11 | 12 | my $test_string = 'Perl-SSI'; 13 | 14 | $r->subprocess_env->set(MY_TEST => $test_string); 15 | 16 | print <
18 | Local date is
19 | Brought to you by 20 | 21 |
22 | EOF 23 | 24 | -------------------------------------------------------------------------------- /t/htdocs/includes/clear.shtml: -------------------------------------------------------------------------------- 1 | This is a REMOVEclear text 2 | -------------------------------------------------------------------------------- /t/htdocs/includes/footer.shtml: -------------------------------------------------------------------------------- 1 |
2 |
footer
3 | -------------------------------------------------------------------------------- /t/htdocs/includes/header.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <!--#echo var="QUERY_STRING" --> 4 | 5 | 6 | 7 |

8 | -------------------------------------------------------------------------------- /t/htdocs/includes/test.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

[back]

8 | 9 | 10 | -------------------------------------------------------------------------------- /t/htdocs/merge3/htaccess: -------------------------------------------------------------------------------- 1 | # htaccess file for t/response/TestModperl/merge.pm 2 | 3 | PerlSetEnv MergeSetEnv3 SetEnv3Merge3Val 4 | PerlSetVar MergeSetVar3 SetVar3Merge3Val 5 | PerlSetVar MergeAddVar3 AddVar3Merge3Val1 6 | PerlAddVar MergeAddVar3 AddVar3Merge3Val2 7 | -------------------------------------------------------------------------------- /t/htdocs/modperl/setupenv2/config_require.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | TestModperl::setupenv2::register_mixed(); 3 | TestModperl::setupenv2::register_perl(); 4 | $ENV{EnvChangeMixedTest} = "config_require"; 5 | $ENV{EnvChangePerlTest} = "config_require"; 6 | 1; 7 | -------------------------------------------------------------------------------- /t/htdocs/modperl/setupenv2/module.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package htdocs::modperl::setupenv2::module; 3 | TestModperl::setupenv2::register_mixed(); 4 | TestModperl::setupenv2::register_perl(); 5 | $ENV{EnvChangeMixedTest} = "perlmodule"; 6 | $ENV{EnvChangePerlTest} = "perlmodule"; 7 | 1; 8 | -------------------------------------------------------------------------------- /t/htdocs/modperl/setupenv2/post_config_require.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | TestModperl::setupenv2::register_mixed(); 3 | TestModperl::setupenv2::register_perl(); 4 | $ENV{EnvChangeMixedTest} = "post_config_require"; 5 | $ENV{EnvChangePerlTest} = "post_config_require"; 6 | 1; 7 | -------------------------------------------------------------------------------- /t/htdocs/modperl/setupenv2/require.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | TestModperl::setupenv2::register_mixed(); 3 | TestModperl::setupenv2::register_perl(); 4 | $ENV{EnvChangeMixedTest} = "require"; 5 | $ENV{EnvChangePerlTest} = "require"; 6 | 1; 7 | -------------------------------------------------------------------------------- /t/htdocs/perlio/MoonRise.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/mod_perl/ead5012b9f8bca08415f39e15226dbc6112a9538/t/htdocs/perlio/MoonRise.jpeg -------------------------------------------------------------------------------- /t/htdocs/perlio/redrum.txt: -------------------------------------------------------------------------------- 1 | ALL wORk and NO play mAKes Jack A dull BoY. 2 | ALl WORK and no plAy makEs JaCk a dULl boY. 3 | All wORk AND no PLAy mAkes JACk A DULL boy. 4 | AlL WORK and nO play MAKES JacK a dUlL bOy. 5 | ALL wOrK ANd no PLAY makes JACk A dULl Boy. 6 | All woRk and NO play mAKes Jack a Dull BOY. 7 | alL work and no pLaY makeS JaCk a dull boy. 8 | aLL wORK aND nO pLAY mAKES Jack A dULL bOY. 9 | -------------------------------------------------------------------------------- /t/htdocs/protocols/basic-auth: -------------------------------------------------------------------------------- 1 | stas:$apr1$qnKIk...$TRSGo5zlwo3LMc0R/iLWo/ 2 | -------------------------------------------------------------------------------- /t/htdocs/vhost/post_config.pl: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache2::ServerUtil (); 6 | 7 | $TestVhost::config::restart_count = Apache2::ServerUtil::restart_count(); 8 | 9 | 1; 10 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/base64.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::base64; 3 | 4 | # testing APR::Base64 API 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use APR::Base64; 13 | 14 | sub num_of_tests { 15 | return 3; 16 | } 17 | 18 | sub test { 19 | 20 | my $str = '12345qwert!@#$%'; 21 | my $encoded = APR::Base64::encode($str); 22 | 23 | t_debug("encoded string: $encoded"); 24 | ok t_cmp($encoded, 'MTIzNDVxd2VydCFAIyQl', 'encode'); 25 | 26 | ok t_cmp(APR::Base64::encode_len(length $str), 27 | length $encoded, 28 | "encoded length"); 29 | 30 | ok t_cmp(APR::Base64::decode($encoded), $str, "decode"); 31 | 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/error.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::error; 3 | 4 | # testing APR::Error API 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use APR::Error; 13 | 14 | sub num_of_tests { 15 | return 1; 16 | } 17 | 18 | sub test { 19 | ok 1; 20 | } 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/os.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::os; 3 | 4 | # testing APR::OS API 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use APR::OS (); 13 | 14 | sub num_of_tests { 15 | return 1; 16 | } 17 | 18 | sub test { 19 | ok 1; 20 | } 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/status.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::status; 3 | 4 | # Testing APR::Status 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use APR::Const -compile => qw(EAGAIN ENOPOLL); 13 | use APR::Status (); 14 | 15 | sub num_of_tests { 16 | return 2; 17 | } 18 | 19 | sub test { 20 | ok APR::Status::is_EAGAIN(APR::Const::EAGAIN); 21 | ok ! APR::Status::is_EAGAIN(APR::Const::ENOPOLL); 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/string.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::string; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use APR::String (); 11 | 12 | my %size_string = ( 13 | '-1' => " - ", 14 | 0 => " 0 ", 15 | 42 => " 42 ", 16 | 42_000 => " 41K", 17 | 42_000_000 => " 40M", 18 | # 42_000_000_000 => "40G", 19 | ); 20 | 21 | sub num_of_tests { 22 | return scalar keys %size_string; 23 | } 24 | 25 | sub test { 26 | 27 | t_debug("size_string"); 28 | while (my ($k, $v) = each %size_string) { 29 | ok t_cmp($v, APR::String::format_size($k)); 30 | } 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/threadrwlock.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::threadrwlock; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use APR::Const -compile => qw(EBUSY SUCCESS); 11 | use APR::Pool(); 12 | 13 | sub num_of_tests { 14 | return 5; 15 | } 16 | 17 | sub test { 18 | 19 | require APR::ThreadRWLock; 20 | 21 | my $pool = APR::Pool->new(); 22 | my $mutex = APR::ThreadRWLock->new($pool); 23 | 24 | ok $mutex; 25 | 26 | ok t_cmp($mutex->rdlock, APR::Const::SUCCESS, 27 | 'rdlock == APR::Const::SUCCESS'); 28 | 29 | ok t_cmp($mutex->unlock, APR::Const::SUCCESS, 30 | 'unlock == APR::Const::SUCCESS'); 31 | 32 | ok t_cmp($mutex->wrlock, APR::Const::SUCCESS, 33 | 'wrlock == APR::Const::SUCCESS'); 34 | 35 | ok t_cmp($mutex->unlock, APR::Const::SUCCESS, 36 | 'unlock == APR::Const::SUCCESS'); 37 | 38 | } 39 | 40 | 1; 41 | -------------------------------------------------------------------------------- /t/lib/TestAPRlib/uuid.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPRlib::uuid; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | my $dummy_uuid = 'd48889bb-d11d-b211-8567-ec81968c93c6'; 10 | 11 | require APR; 12 | require APR::UUID; 13 | 14 | #XXX: apr_generate_random_bytes may block forever on /dev/random 15 | # my $uuid = APR::UUID->new->format; 16 | 17 | sub num_of_tests { 18 | return 3; 19 | } 20 | 21 | sub test { 22 | my $uuid = $dummy_uuid; 23 | 24 | ok $uuid; 25 | 26 | my $uuid_parsed = APR::UUID->parse($uuid); 27 | 28 | ok $uuid_parsed; 29 | 30 | ok $uuid eq $uuid_parsed->format; 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /t/lib/TestCommon/TiePerlSection.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestCommon::TiePerlSection; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | # the following is needed for the tied %Location test in 8 | # sections. Unfortunately it can't be defined in the section itself 9 | # due to the bug in perl: 10 | # http://rt.perl.org:80/rt3/Ticket/Display.html?id=29018 11 | 12 | use Tie::Hash; 13 | our @ISA = qw(Tie::StdHash); 14 | sub FETCH { 15 | my ($hash, $key) = @_; 16 | if ($key eq '/tied') { 17 | return 'TIED'; 18 | } 19 | return $hash->{$key}; 20 | } 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /t/lib/TestExit/FromPerlModule.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestExit::FromPerlModule; 3 | 4 | use strict; 5 | use warnings FATAL => qw(all); 6 | 7 | use Apache2::ServerRec; 8 | use Apache2::ServerUtil; 9 | use Apache2::Log; 10 | use Apache2::Const -compile => qw(OK); 11 | 12 | sub exit_handler { 13 | my ($p, $s) = @_; 14 | 15 | $s->log->info("Child process pid=$$ is exiting - server push"); 16 | 17 | Apache2::Const::OK; 18 | } 19 | 20 | Apache2::ServerUtil->server->push_handlers(PerlChildExitHandler => \&exit_handler); 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /t/modperl/exit.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest 'GET_BODY_ASSERT'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use ModPerl::Const -compile => 'EXIT'; 11 | 12 | my $location = "/TestModperl__exit"; 13 | 14 | plan tests => 3; 15 | 16 | { 17 | ok t_cmp(GET_BODY_ASSERT("$location?noneval"), 18 | 'exited', 19 | "exit in non eval context"); 20 | 21 | } 22 | { 23 | my $exit_excpt = ModPerl::EXIT; 24 | my $body = GET_BODY_ASSERT("$location?eval"); 25 | ok t_cmp($body, 26 | qr/^ModPerl::Util::exit: \($exit_excpt\) exit was called/, 27 | "exit in eval context"); 28 | 29 | ok !t_cmp($body, 30 | qr/must not be reached/, 31 | "exit in eval context"); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /t/modperl/getc.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 2; 10 | 11 | my $location = "/TestModperl__getc"; 12 | 13 | my $expect = join '', 'a'..'Z'; 14 | 15 | my $str = POST_BODY $location, content => $expect; 16 | 17 | ok $str; 18 | 19 | ok t_cmp($str, $expect, 'getc'); 20 | 21 | -------------------------------------------------------------------------------- /t/modperl/local_env.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | plan tests => 1, skip_reason('local %ENV is still broken'); 10 | 11 | my $module = 'TestModperl::local_env'; 12 | my $url = Apache::TestRequest::module2url($module); 13 | 14 | t_debug "connecting to $url"; 15 | print GET_BODY_ASSERT $url; 16 | -------------------------------------------------------------------------------- /t/modperl/merge.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestModperl::merge'; 10 | my $url = Apache::TestRequest::module2url($module, {path => '/merge/'}); 11 | 12 | # test server-to-container merging (without overrides) for: 13 | # PerlSetEnv 14 | # PerlPassEnv 15 | # PerlSetVar 16 | # PerlAddVar 17 | 18 | t_debug("connecting to $url"); 19 | print GET_BODY_ASSERT $url; 20 | -------------------------------------------------------------------------------- /t/modperl/merge2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestModperl::merge'; 10 | my $url = Apache::TestRequest::module2url($module, {path => '/merge2/'}); 11 | 12 | # test server-to-container merging (with overrides) for: 13 | # PerlSetEnv 14 | # PerlPassEnv 15 | # PerlSetVar 16 | # PerlAddVar 17 | 18 | t_debug("connecting to $url"); 19 | print GET_BODY_ASSERT $url; 20 | -------------------------------------------------------------------------------- /t/modperl/merge3.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestModperl::merge'; 10 | my $url = Apache::TestRequest::module2url($module, {path => '/merge3/'}); 11 | 12 | # test multi-level merging (server-to-container-to-htaccess) for: 13 | # PerlSetEnv 14 | # PerlPassEnv 15 | # PerlSetVar 16 | # PerlAddVar 17 | 18 | t_debug("connecting to $url"); 19 | print GET_BODY_ASSERT $url; 20 | -------------------------------------------------------------------------------- /t/modperl/perl_options.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $module = 'TestModperl::perl_options'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug "connecting to $url"; 13 | print GET_BODY_ASSERT $url; 14 | -------------------------------------------------------------------------------- /t/modperl/perl_options2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $module = 'TestModperl::perl_options2'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug "connecting to $url"; 13 | print GET_BODY_ASSERT $url; 14 | -------------------------------------------------------------------------------- /t/modperl/pnotes.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestModperl::pnotes'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug("connecting to $url"); 13 | 14 | plan tests => (26 * 3), need_lwp; 15 | 16 | # first with keepalives 17 | Apache::TestRequest::user_agent(reset => 1, keep_alive => 1); 18 | t_debug("issuing first request"); 19 | print GET_BODY_ASSERT "$url?1"; 20 | 21 | # now close the connection 22 | t_debug("issuing second request"); 23 | print GET_BODY_ASSERT "$url?2", Connection => 'close'; 24 | 25 | # finally, check for a cleared $c->pnotes 26 | t_debug("issuing final request"); 27 | print GET_BODY_ASSERT "$url?3"; 28 | 29 | -------------------------------------------------------------------------------- /t/modperl/pnotes2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | use Apache::TestUtil qw/t_start_error_log_watch t_finish_error_log_watch/; 9 | 10 | my $module = 'TestModperl::pnotes2'; 11 | my $url = Apache::TestRequest::module2url($module); 12 | my ($u, $ok); 13 | 14 | t_debug("connecting to $url"); 15 | 16 | plan tests => 12, need_lwp; 17 | 18 | Apache::TestRequest::user_agent(reset => 1, keep_alive => 0); 19 | 20 | for my $i (1..12) { 21 | t_client_log_warn_is_expected(); 22 | t_start_error_log_watch; 23 | $u="$url?$i"; $ok=GET_BODY $u; 24 | select undef, undef, undef, 0.2; # give it time to write the logfile 25 | ok t_cmp scalar(grep { 26 | /pnotes are destroyed after cleanup passed/; 27 | } t_finish_error_log_watch), 1, $u; 28 | } 29 | -------------------------------------------------------------------------------- /t/modperl/print_utf8.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | # utf encode/decode was added only in 5.8.0 10 | # XXX: currently binmode is only available with perlio (used on the 11 | # server side on the tied/perlio STDOUT) 12 | plan tests => 1, need need_min_perl_version(5.008), need_perl('perlio'); 13 | 14 | my $location = "/TestModperl__print_utf8"; 15 | my $expected = "Hello Ayhan \x{263A} perlio rules!"; 16 | 17 | my $res = GET $location; 18 | my $received = $res->content; 19 | 20 | # response body includes wide-chars, but perl doesn't know about it 21 | utf8::decode($received) if ($res->header('Content-Type')||'') =~ /utf-8/i; 22 | 23 | # needed for debugging print out of utf8 strings 24 | binmode(STDOUT, ':utf8'); 25 | ok t_cmp($received, $expected, 'UTF8 response via tied/perlio STDOUT'); 26 | 27 | -------------------------------------------------------------------------------- /t/modperl/readline.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 2; 10 | 11 | my $location = "/TestModperl__readline"; 12 | 13 | my $expect = join "\n", map { $_ x 24 } 'a'..'e'; 14 | 15 | my $str = POST_BODY $location, content => $expect; 16 | 17 | ok $str; 18 | 19 | ok t_cmp($str, $expect, 'readline'); 20 | 21 | -------------------------------------------------------------------------------- /t/modperl/request_rec_perlio_api.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | use Config; 10 | 11 | my $uri = "/TestModperl__request_rec_perlio_api"; 12 | 13 | plan tests => 2, need { "perl $]: TIEd IO is used instead of PerlIO" 14 | => ($] >= 5.008 && $Config{useperlio}) }; 15 | 16 | 17 | { 18 | my $content = join "", 'a'..'j', 'k'..'t'; 19 | my $location = "$uri?STDIN"; 20 | my $expected = join "", 'a'..'j', "# please", 'k'..'t'; 21 | my $received = POST_BODY_ASSERT $location, content => $content; 22 | ok t_cmp($received, $expected, "STDIN tests"); 23 | } 24 | 25 | { 26 | my $location = "$uri?STDOUT"; 27 | my $expected = "life is hard and then you die! next you reincarnate..."; 28 | my $received = GET_BODY_ASSERT $location; 29 | ok t_cmp($received, $expected, "STDOUT tests"); 30 | } 31 | -------------------------------------------------------------------------------- /t/modules/apache_resource.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | plan tests => 1, need qw[BSD::Resource], 10 | { "CGI.pm (2.93 or higher) or Apache2::Request is needed" => 11 | !!(eval { require CGI && $CGI::VERSION >= 2.93 } || 12 | eval { require Apache2::Request })}; 13 | 14 | { 15 | # Apache2::Status menu inserted by Apache::Resource 16 | my $url = '/status/perl?rlimit'; 17 | my $body = GET_BODY_ASSERT $url; 18 | ok $body =~ /RLIMIT_CPU/; 19 | } 20 | 21 | # more tests would be nice, but I'm not sure how to write those w/o 22 | # causing problems to the rest of the test suite. 23 | # we could enable $ENV{PERL_RLIMIT_DEFAULTS} = 1; before loading 24 | # Apache2::Resource, which sets certain default values (works for me) 25 | # but it's not guaranteed that it'll work for others (since it's very 26 | # OS specific) 27 | -------------------------------------------------------------------------------- /t/modules/include.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | #test for mod_include include virtual of a mod_perl script 10 | my @patterns = ( 11 | 'mod_perl mod_include test', 12 | 'Hello World', 13 | 'cgi.pm', 14 | 'footer', 15 | ); 16 | 17 | plan tests => 2 + @patterns, need need_module('mod_include', 'mod_mime'), 18 | need_min_module_version(CGI => 3.08); 19 | 20 | my $location = "/includes/test.shtml"; 21 | 22 | 23 | my($res, $str); 24 | 25 | $res = GET $location; 26 | 27 | ok $res->is_success; 28 | 29 | $str = $res->content; 30 | 31 | ok $str; 32 | 33 | for my $pat (@patterns) { 34 | ok t_cmp($str, qr{$pat}, "/$pat/"); 35 | } 36 | -------------------------------------------------------------------------------- /t/modules/include2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | #test for mod_include parsing of mod_perl script output 10 | #XXX: needs to be more robust. see t/htdocs/includes-registry/test.spl 11 | my @patterns = ( 12 | 'Perl-SSI', #MY_TEST 13 | 'mod_perl', #SERVER_SOFTWARE 14 | ); 15 | 16 | plan tests => 2 + @patterns, ['include', 'mod_mime', 'HTML::HeadParser']; 17 | 18 | my $location = "/includes-registry/test.spl"; 19 | 20 | my($res, $str); 21 | 22 | $res = GET $location; 23 | 24 | ok $res->is_success; 25 | 26 | $str = $res->content; 27 | 28 | ok $str; 29 | 30 | for my $pat (@patterns) { 31 | ok t_cmp($str, qr{$pat}, "/$pat/"); 32 | } 33 | -------------------------------------------------------------------------------- /t/modules/include_subreq.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestRequest; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestModules::include_subreq'; 10 | my $location = '/' . Apache::TestRequest::module2path($module); 11 | 12 | plan tests => 1, ['include']; 13 | 14 | my($res, $str); 15 | 16 | my $expected = "subreq is quite ok"; 17 | my $received = GET_BODY_ASSERT "$location/one"; 18 | ok t_cmp($received, $expected, "handler => filter => handler"); 19 | 20 | -------------------------------------------------------------------------------- /t/modules/proxy.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $module = 'TestModules::proxy'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug("connecting to $url"); 13 | 14 | my @modules = qw(mod_proxy proxy_http.c); 15 | push @modules, 'mod_access_compat' if have_min_apache_version("2.4.0"); 16 | plan tests => 1, need need_module(@modules), need_access; 17 | 18 | my $expected = "ok"; 19 | my $received = GET_BODY_ASSERT $url; 20 | ok t_cmp($received, $expected, "internally proxified request"); 21 | -------------------------------------------------------------------------------- /t/perl/hash_attack.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestTrace; 8 | 9 | use Apache::TestRequest 'GET_BODY_ASSERT'; 10 | 11 | plan tests => 1, 12 | need { "relevant only for perl 5.8.2 and up to 5.17.6" => ($] >= 5.008002 && $] < 5.017006) }; 13 | 14 | my $expected = "ok"; 15 | my $received = GET_BODY_ASSERT "/TestPerl__hash_attack"; 16 | ok($expected eq $received); 17 | -------------------------------------------------------------------------------- /t/perl/ithreads.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # perl/ithreads2 is a similar test but is running from within a 3 | # virtual host with its own perl interpreter pool (+Parent) 4 | 5 | use Config; 6 | 7 | use Apache::Test; 8 | use Apache::TestRequest 'GET_BODY_ASSERT'; 9 | 10 | # perl < 5.6.0 fails to compile code with 'shared' attributes, so we must skip 11 | # it here. 12 | unless ($] >= 5.008001 && $Config{useithreads}) { 13 | plan tests => 1, need 14 | {"perl 5.8.1 or higher w/ithreads enabled is required" => 0}; 15 | } 16 | 17 | print GET_BODY_ASSERT "/TestPerl__ithreads"; 18 | -------------------------------------------------------------------------------- /t/perl/ithreads2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # perl/ithreads is a similar test but is running from the global perl 3 | # interpreter pool. whereas this test is running against a 4 | # virtual host with its own perl interpreter pool (+Parent) 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Config; 10 | 11 | use Apache::Test; 12 | use Apache::TestUtil; 13 | use Apache::TestRequest 'GET_BODY_ASSERT'; 14 | 15 | # perl < 5.6.0 fails to compile code with 'shared' attributes, so we must skip 16 | # it here. 17 | unless ($] >= 5.008001 && $Config{useithreads}) { 18 | plan tests => 1, need 19 | {"perl 5.8.1 or higher w/ithreads enabled is required" => 0}; 20 | } 21 | 22 | my $module = 'TestPerl::ithreads'; 23 | my $url = Apache::TestRequest::module2url($module); 24 | 25 | t_debug("connecting to $url"); 26 | print GET_BODY_ASSERT $url; 27 | -------------------------------------------------------------------------------- /t/perl/ithreads3.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest 'GET_BODY'; 8 | 9 | plan tests => 6, need_apache_mpm('worker') && need_perl('ithreads'); 10 | 11 | my $module = 'TestPerl::ithreads3'; 12 | 13 | sub u {Apache::TestRequest::module2url($module, {path=>$_[0]})} 14 | sub t { 15 | my $rc; 16 | eval { 17 | local $SIG{ALRM}=sub {die "Timeout\n"}; 18 | alarm 2; 19 | eval { 20 | $rc=GET_BODY u(shift); 21 | }; 22 | alarm 0; 23 | }; 24 | alarm 0; 25 | return $rc; 26 | } 27 | 28 | t_debug("connecting to ".u('')); 29 | ok t_cmp t('/perl-script?1'), 2, 'perl-script 1'; 30 | ok t_cmp t('/modperl?1'), 2, 'modperl 1'; 31 | 32 | ok t_cmp t('/perl-script?2'), 5, 'perl-script 2'; 33 | ok t_cmp t('/modperl?2'), 5, 'modperl 2'; 34 | 35 | ok t_cmp t('/perl-script?3'), 3, 'perl-script 3'; 36 | ok t_cmp t('/modperl?3'), 3, 'modperl 3'; 37 | -------------------------------------------------------------------------------- /t/preconnection/note.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest; 8 | 9 | my $module = 'TestPreConnection::note'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | my $config = Apache::Test::config(); 12 | 13 | my $remote_addr = $config->{vars}->{remote_addr}; 14 | t_debug("connecting to $url"); 15 | plan tests => 1; 16 | 17 | ok t_cmp( 18 | GET_BODY_ASSERT($url), 19 | $remote_addr, 20 | "connection notes"); 21 | -------------------------------------------------------------------------------- /t/protocol/echo_bbs.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(hello wonderful world); 10 | 11 | plan tests => 1 + @test_strings; 12 | 13 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_bbs'); 14 | 15 | ok $socket; 16 | 17 | for (@test_strings) { 18 | print $socket "$_\n"; 19 | chomp(my $reply = <$socket>||''); 20 | ok t_cmp($reply, uc($_)); 21 | } 22 | -------------------------------------------------------------------------------- /t/protocol/echo_bbs2.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(hello world); 10 | 11 | plan tests => 1 + @test_strings; 12 | 13 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_bbs2'); 14 | 15 | ok $socket; 16 | 17 | for (@test_strings) { 18 | print $socket "$_\n"; 19 | chomp(my $reply = <$socket>||''); 20 | ok t_cmp($reply, uc($_)); 21 | } 22 | -------------------------------------------------------------------------------- /t/protocol/echo_block.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(hello world); 10 | 11 | # blocking socket bug fixed in 2.0.52 12 | my $ok = $^O !~ /^(Open|Net)BSD$/i || need_min_apache_version('2.0.52'); 13 | 14 | plan tests => 1 + @test_strings, $ok; 15 | 16 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_block'); 17 | 18 | ok $socket; 19 | 20 | for (@test_strings) { 21 | print $socket "$_\n"; 22 | chomp(my $reply = <$socket>||''); 23 | ok t_cmp($reply, $_); 24 | } 25 | -------------------------------------------------------------------------------- /t/protocol/echo_filter.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(hello world); 10 | 11 | # blocking socket bug fixed in 2.0.52 12 | my $ok = $^O !~ /^(Open|Net)BSD$/i || need_min_apache_version('2.0.52'); 13 | 14 | plan tests => 1 + @test_strings, $ok; 15 | 16 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_filter'); 17 | 18 | ok $socket; 19 | 20 | for (@test_strings) { 21 | print $socket "$_\n"; 22 | chomp(my $reply = <$socket>||''); 23 | ok t_cmp($reply, uc($_)); 24 | } 25 | -------------------------------------------------------------------------------- /t/protocol/echo_nonblock.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | plan tests => 3; 10 | 11 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_nonblock'); 12 | 13 | ok $socket; 14 | 15 | my $received; 16 | my $expected; 17 | 18 | $expected = "nonblocking"; 19 | print $socket "$expected\n"; 20 | chomp($received = <$socket> || ''); 21 | ok t_cmp $received, $expected, "no timeout"; 22 | 23 | # now get a timed out request 24 | $expected = "TIMEUP"; 25 | sleep 1; # try to ensure a CPU context switch for the server 26 | print $socket "should timeout\n"; 27 | chomp($received = <$socket> || ''); 28 | ok t_cmp $received, $expected, "timed out"; 29 | 30 | -------------------------------------------------------------------------------- /t/protocol/echo_timeout.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest (); 8 | 9 | my @test_strings = qw(good bye cruel world); 10 | 11 | plan tests => 1 + @test_strings; 12 | 13 | my $socket = Apache::TestRequest::vhost_socket('TestProtocol::echo_timeout'); 14 | 15 | ok $socket; 16 | 17 | for (@test_strings) { 18 | print $socket "$_\n"; 19 | chomp(my $reply = <$socket>||''); 20 | ok t_cmp($reply, $_); 21 | } 22 | -------------------------------------------------------------------------------- /t/response/TestAPI/content_encoding.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::content_encoding; 3 | 4 | # tests: $r->content_encoding("gzip"); 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache2::RequestRec (); 10 | use Apache2::RequestUtil (); 11 | 12 | use TestCommon::Utils (); 13 | 14 | use Apache2::Const -compile => qw(OK DECLINED M_POST); 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | return Apache2::Const::DECLINED unless $r->method_number == Apache2::Const::M_POST; 20 | 21 | my $data = TestCommon::Utils::read_post($r); 22 | 23 | require Compress::Zlib; 24 | 25 | $r->content_type("text/plain"); 26 | $r->content_encoding("gzip"); 27 | 28 | $r->print(Compress::Zlib::memGzip($data)); 29 | 30 | Apache2::Const::OK; 31 | } 32 | 33 | 1; 34 | __END__ 35 | -------------------------------------------------------------------------------- /t/response/TestAPI/custom_response.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::custom_response; 3 | 4 | # custom_response() doesn't alter the response code, but is used to 5 | # replace the standard response body 6 | 7 | use strict; 8 | use warnings FATAL => 'all'; 9 | 10 | use Apache2::Response (); 11 | 12 | use Apache2::Const -compile => qw(FORBIDDEN); 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | my $how = $r->args || ''; 18 | # warn "$how"; 19 | # could be text or url 20 | $r->custom_response(Apache2::Const::FORBIDDEN, $how); 21 | 22 | return Apache2::Const::FORBIDDEN; 23 | } 24 | 25 | 1; 26 | __END__ 27 | 28 | 29 | AuthName dummy 30 | AuthType none 31 | PerlAccessHandler TestAPI::custom_response 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /t/response/TestAPI/err_headers_out.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::err_headers_out; 3 | 4 | # tests: $r->err_headers_out 5 | 6 | # when sending a non-2xx response one must use $r->err_headers_out to 7 | # set extra headers 8 | 9 | use strict; 10 | use warnings FATAL => 'all'; 11 | 12 | use Apache2::RequestRec (); 13 | use Apache2::RequestUtil (); 14 | use APR::Table (); 15 | 16 | use Apache2::Const -compile => qw(OK NOT_FOUND); 17 | 18 | sub handler { 19 | my $r = shift; 20 | 21 | # this header will always make it to the client 22 | $r->err_headers_out->add('X-err_headers_out' => "err_headers_out"); 23 | 24 | # this header will make it to the client only on 2xx response 25 | $r->headers_out->add('X-headers_out' => "headers_out"); 26 | 27 | return $r->args eq "404" ? Apache2::Const::NOT_FOUND : Apache2::Const::OK; 28 | } 29 | 30 | 1; 31 | __END__ 32 | -------------------------------------------------------------------------------- /t/response/TestAPI/process.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::process; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::RequestRec (); 11 | use Apache2::ServerRec (); 12 | use Apache2::Process (); 13 | 14 | use Apache2::Const -compile => 'OK'; 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | plan $r, tests => 4; 20 | 21 | my $s = $r->server; 22 | my $proc = $s->process; 23 | ok t_cmp(1, $proc->isa('Apache2::Process'), "isa('Apache2::Process')"); 24 | 25 | my $global_pool = $proc->pool; 26 | ok t_cmp(1, $global_pool->isa('APR::Pool'), "pglob isa('APR::Pool')"); 27 | 28 | my $pconf = $proc->pconf; 29 | ok t_cmp(1, $pconf->isa('APR::Pool'), "pconf isa('APR::Pool')"); 30 | 31 | my $proc_name = $proc->short_name; 32 | t_debug($proc_name); 33 | ok $proc_name; 34 | 35 | Apache2::Const::OK; 36 | } 37 | 38 | 1; 39 | 40 | __END__ 41 | -------------------------------------------------------------------------------- /t/response/TestAPI/show.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::show; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::MPM (); 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | plan $r, tests => 1; 17 | 18 | my $mpm = Apache::Test::config->{server}->{mpm}; 19 | 20 | ok t_cmp(Apache2::MPM->show(), 21 | qr!$mpm!i, 22 | 'Apache2::MPM->show()'); 23 | 24 | Apache2::Const::OK; 25 | } 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /t/response/TestAPI/status.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPI::status; 3 | 4 | # see the client for details 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache2::RequestRec (); 10 | use Apache2::RequestIO (); 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | my $body = "This is a response string"; 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | $r->content_type('text/plain'); 20 | 21 | my ($code, $string) = split /=/, $r->args || ''; 22 | 23 | if ($string) { 24 | # status_line must be valid and match status 25 | # or it is 'zapped' by httpd as of 2.2.1 26 | $r->status($code); 27 | $r->status_line("$code $string"); 28 | } 29 | else { 30 | $r->status($code); 31 | } 32 | 33 | Apache2::Const::OK; 34 | } 35 | 36 | 1; 37 | -------------------------------------------------------------------------------- /t/response/TestAPR/base64.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::base64; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache2::Const -compile => 'OK'; 9 | 10 | use TestAPRlib::base64; 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | my $num_of_tests = TestAPRlib::base64::num_of_tests(); 16 | plan $r, tests => $num_of_tests; 17 | 18 | TestAPRlib::base64::test(); 19 | 20 | Apache2::Const::OK; 21 | } 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /t/response/TestAPR/date.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::date; 3 | 4 | # testing APR::Date API 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | use TestAPRlib::date; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | my $num_of_tests = TestAPRlib::date::num_of_tests(); 19 | plan $r, tests => $num_of_tests; 20 | 21 | TestAPRlib::date::test(); 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | __END__ 28 | -------------------------------------------------------------------------------- /t/response/TestAPR/finfo.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::finfo; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::RequestRec (); 11 | use Apache2::RequestIO (); 12 | 13 | use TestAPRlib::finfo; 14 | 15 | use APR::Finfo (); 16 | 17 | use Apache2::Const -compile => 'OK'; 18 | 19 | sub handler { 20 | my $r = shift; 21 | 22 | my $tests = 1 + TestAPRlib::finfo::num_of_tests(); 23 | plan $r, tests => $tests; 24 | 25 | { 26 | my $finfo = $r->finfo; 27 | my $isa = $finfo->isa('APR::Finfo'); 28 | 29 | t_debug "\$r->finfo $finfo"; 30 | ok $isa; 31 | } 32 | 33 | # a test assigning to $r->finfo is in TestAPI::request_rec 34 | 35 | TestAPRlib::finfo::test(); 36 | 37 | Apache2::Const::OK; 38 | } 39 | 40 | 1; 41 | -------------------------------------------------------------------------------- /t/response/TestAPR/os.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::os; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::MPM (); 11 | use APR::OS (); 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | plan $r, tests => 1; 19 | 20 | if (Apache2::MPM->is_threaded) { 21 | my $tid = APR::OS::current_thread_id(); 22 | ok t_cmp($tid, $tid, "current thread id: $tid / pid: $$"); 23 | } 24 | else { 25 | ok t_cmp($$, $$, "current process id"); 26 | } 27 | 28 | Apache2::Const::OK; 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /t/response/TestAPR/pool_lifetime.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::pool_lifetime; 3 | 4 | # this test verifies that if the perl pool object exceeds the 5 | # life-span of the underlying pool struct we don't get segfaults 6 | 7 | use strict; 8 | use warnings FATAL => 'all'; 9 | 10 | use Apache2::RequestRec (); 11 | use Apache2::RequestIO (); 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | my $pool; 16 | 17 | sub handler { 18 | my $r = shift; 19 | 20 | $r->print("Pong"); 21 | $pool = $r->pool; 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /t/response/TestAPR/status.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::status; 3 | 4 | # Testing APR::Status 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | use TestAPRlib::status; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | my $num_of_tests = TestAPRlib::status::num_of_tests(); 19 | plan $r, tests => $num_of_tests; 20 | 21 | TestAPRlib::status::test(); 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/response/TestAPR/string.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::string; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use Apache2::Const -compile => 'OK'; 10 | 11 | require TestAPRlib::string; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | my $num_of_tests = TestAPRlib::string::num_of_tests(); 17 | plan $r, tests => $num_of_tests; 18 | 19 | TestAPRlib::string::test(); 20 | 21 | Apache2::Const::OK; 22 | } 23 | 24 | 1; 25 | __END__ 26 | -------------------------------------------------------------------------------- /t/response/TestAPR/table.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::table; 3 | 4 | # testing APR::Table API 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | use TestAPRlib::table; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | my $tests = TestAPRlib::table::num_of_tests(); 18 | plan $r, tests => $tests; 19 | 20 | TestAPRlib::table::test(); 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /t/response/TestAPR/threadmutex.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::threadmutex; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | use TestAPRlib::threadmutex; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | my $tests = TestAPRlib::threadmutex::num_of_tests(); 18 | plan $r, tests => $tests, need_threads; 19 | 20 | TestAPRlib::threadmutex::test(); 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /t/response/TestAPR/threadrwlock.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::threadrwlock; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | use TestAPRlib::threadrwlock; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | my $tests = TestAPRlib::threadrwlock::num_of_tests(); 18 | plan $r, tests => $tests, need_threads; 19 | 20 | TestAPRlib::threadrwlock::test(); 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /t/response/TestAPR/uri.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::uri; 3 | 4 | # Testing APR::URI (more tests in TestAPI::uri) 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | use TestAPRlib::uri; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | my $num_of_tests = TestAPRlib::uri::num_of_tests(); 19 | plan $r, tests => $num_of_tests; 20 | 21 | TestAPRlib::uri::test(); 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/response/TestAPR/util.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::util; 3 | 4 | # test APR::Util 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | use TestAPRlib::util; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | my $num_of_tests = TestAPRlib::util::num_of_tests(); 19 | plan $r, tests => $num_of_tests; 20 | 21 | TestAPRlib::util::test(); 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /t/response/TestAPR/uuid.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestAPR::uuid; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use TestAPRlib::uuid; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | plan $r, tests => TestAPRlib::uuid::num_of_tests(); 17 | 18 | TestAPRlib::uuid::test(); 19 | 20 | Apache2::Const::OK; 21 | } 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /t/response/TestApache/content_length_header.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::content_length_header; 3 | 4 | # see the client t/apache/content_length_header.t for the comments 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache2::RequestRec (); 10 | use Apache2::RequestIO (); 11 | use Apache2::Response (); 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | my $body = "This is a response string"; 16 | 17 | sub handler { 18 | my $r = shift; 19 | 20 | $r->content_type('text/plain'); 21 | 22 | my $args = $r->args || ''; 23 | 24 | if ($args =~ /set_content_length/) { 25 | $r->set_content_length(length $body); 26 | } 27 | 28 | if ($args =~ /send_body/) { 29 | $r->print($body); 30 | } 31 | 32 | if ($args =~ /head_no_body/) { 33 | if ($r->header_only) { 34 | # see #2 in the discussion in the client 35 | $r->rflush; 36 | } 37 | } 38 | 39 | Apache2::Const::OK; 40 | } 41 | 42 | 1; 43 | -------------------------------------------------------------------------------- /t/response/TestApache/daemon.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::daemon; 3 | 4 | # Apache2::ServerUtil tests 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache2::ServerUtil (); 10 | 11 | use Apache::TestConfig (); 12 | use Apache::TestUtil; 13 | use Apache::Test; 14 | 15 | use constant WIN32 => Apache::TestConfig::WIN32; 16 | 17 | use Apache2::Const -compile => 'OK'; 18 | 19 | sub handler { 20 | my $r = shift; 21 | 22 | plan $r, tests => 2; 23 | 24 | my $user_id = Apache2::ServerUtil->user_id; 25 | my $user_id_expected = WIN32 ? 0 : $<; 26 | 27 | ok t_cmp $user_id, $user_id_expected, "user id"; 28 | 29 | my $group_id = Apache2::ServerUtil->group_id; 30 | my ($group_id_expected) = WIN32 ? 0 : ($( =~ /^(\d+)/); 31 | 32 | ok t_cmp $group_id, $group_id_expected, "group id"; 33 | 34 | Apache2::Const::OK; 35 | } 36 | 37 | 1; 38 | 39 | __END__ 40 | 41 | -------------------------------------------------------------------------------- /t/response/TestApache/post.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::post; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestRec (); 8 | use Apache2::RequestIO (); 9 | 10 | use TestCommon::Utils (); 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | sub handler { 15 | my $r = shift; 16 | $r->content_type('text/plain'); 17 | 18 | my $data = TestCommon::Utils::read_post($r) || ""; 19 | 20 | $r->puts(join ':', length($data), $data); 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /t/response/TestApache/scanhdrs.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::scanhdrs; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use Apache2::compat (); 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | print "Status: 200 Bottles of beer on the wall\n"; 17 | print 'X-Perl-Module', ': ', __PACKAGE__; 18 | print "\r\n"; 19 | print "Content-type: text/test-"; 20 | print "output\n"; 21 | print "\n"; 22 | 23 | print "ok 1\n"; 24 | 25 | Apache2::Const::OK; 26 | } 27 | 28 | 1; 29 | __END__ 30 | SetHandler perl-script 31 | PerlOptions +ParseHeaders 32 | -------------------------------------------------------------------------------- /t/response/TestApache/scanhdrs2.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::scanhdrs2; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | 9 | use Apache2::Const -compile => 'OK'; 10 | 11 | sub handler { 12 | my $r = shift; 13 | 14 | my $location = $r->args; 15 | 16 | print "Location: $location\n\n"; 17 | 18 | Apache2::Const::OK; 19 | } 20 | 21 | 1; 22 | __END__ 23 | SetHandler perl-script 24 | PerlOptions +ParseHeaders 25 | -------------------------------------------------------------------------------- /t/response/TestApache/send_cgi_header.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::send_cgi_header; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::Response (); 8 | 9 | use Apache2::Const -compile => qw(OK); 10 | 11 | sub handler { 12 | my $r = shift; 13 | 14 | # at the same time test the \0 binary at the beginning of the data 15 | my $response = <send_cgi_header($response); 26 | 27 | Apache2::Const::OK; 28 | } 29 | 30 | 1; 31 | __END__ 32 | # this should work regardless whether parse headers is on or off 33 | PerlOptions -ParseHeaders 34 | -------------------------------------------------------------------------------- /t/response/TestApache/write.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestApache::write; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestRec (); 8 | use Apache2::RequestIO (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | use constant BUFSIZ => 512; #small for testing 13 | 14 | sub handler { 15 | my $r = shift; 16 | $r->content_type('text/plain'); 17 | 18 | $r->write("1..2"); 19 | $r->write("\n", 1); 20 | 21 | my $ok = "ok 1\n"; 22 | $r->write($ok, 2); 23 | $r->write($ok, -1, 2); 24 | 25 | $ok = "not ok 2\n"; 26 | $r->write($ok, 5, 4); 27 | 28 | Apache2::Const::OK; 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /t/response/TestCompat/apache_table.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestCompat::apache_table; 3 | 4 | # Apache::Table compat layer tests 5 | 6 | # these tests are all run and validated on the server side. 7 | 8 | use strict; 9 | use warnings FATAL => 'all'; 10 | 11 | use Apache::TestUtil; 12 | use Apache::Test; 13 | 14 | use Apache2::compat (); 15 | use Apache::Constants qw(OK); 16 | 17 | sub handler { 18 | my $r = shift; 19 | 20 | plan $r, tests => 2; 21 | 22 | $r->send_http_header('text/plain'); 23 | 24 | my $t = Apache::Table->new($r); 25 | my $t_class = ref $t; 26 | 27 | ok t_cmp($t_class, 'APR::Table', "Apache::Table->new"); 28 | 29 | ok t_cmp($r->is_main, !$r->main, 30 | '$r->is_main'); 31 | 32 | OK; 33 | } 34 | 35 | 1; 36 | 37 | -------------------------------------------------------------------------------- /t/response/TestCompat/send_fd.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestCompat::send_fd; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::compat (); 8 | use Apache2::RequestRec (); 9 | 10 | use Apache2::Const -compile => ':common'; 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | my $file = $r->args || __FILE__; 16 | 17 | open my $fh, $file or return Apache2::Const::NOT_FOUND; 18 | 19 | my $bytes = $r->send_fd($fh); 20 | 21 | return Apache2::Const::SERVER_ERROR unless $bytes == -s $file; 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /t/response/TestDirective/pod.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestDirective::pod; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | use Apache2::Const -compile => 'OK'; 10 | 11 | sub handler { 12 | my $r = shift; 13 | 14 | plan $r, tests => 4; 15 | 16 | ok t_cmp $r->dir_config->get('TestDirective__pod_hidden'), undef; 17 | ok t_cmp $r->dir_config->get('TestDirective__pod_over_worked'), 'yes'; 18 | ok t_cmp $r->dir_config->get('TestDirective__pod_cut_worked'), 'yes'; 19 | 20 | #XXX: How to test that __END__ works proprely without cloberring all the other tests? 21 | ok t_cmp '__END__', '__END__'; 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /t/response/TestDirective/setupenv.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestDirective::setupenv; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestRec (); 8 | use Apache2::RequestIO (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | $ENV{QS} = $r->args if $r->args; 16 | 17 | while (my ($key, $val) = each %ENV) { 18 | next unless $key and $val; 19 | $r->puts("$key=$val\n"); 20 | } 21 | 22 | Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | __END__ 27 | PerlOptions +SetupEnv 28 | 29 | -------------------------------------------------------------------------------- /t/response/TestError/api.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestError::api; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestRec (); 8 | use Apache2::RequestUtil (); 9 | use Apache2::RequestIO (); 10 | 11 | use Apache::Test; 12 | use Apache::TestUtil; 13 | 14 | use Apache2::Const -compile => qw(OK); 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | plan $r, tests => 1; 20 | 21 | $r->content_type('text/plain'); 22 | 23 | # PerlOptions -GlobalRequest is in effect 24 | eval { my $gr = Apache2::RequestUtil->request; }; 25 | ok t_cmp($@, 26 | qr/\$r object is not available/, 27 | "unavailable global $r object"); 28 | 29 | return Apache2::Const::OK; 30 | } 31 | 32 | 1; 33 | __END__ 34 | PerlOptions -GlobalRequest 35 | -------------------------------------------------------------------------------- /t/response/TestError/syntax.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestError::syntax; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestRec (); 8 | use Apache2::RequestIO (); 9 | 10 | use Apache2::Const -compile => qw(OK); 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | $r->content_type('text/plain'); 16 | 17 | # the following syntax error is here on purpose! 18 | lkj;\; 19 | 20 | $r->print('ok'); 21 | 22 | return Apache2::Const::OK; 23 | } 24 | 25 | 1; 26 | __END__ 27 | 28 | -------------------------------------------------------------------------------- /t/response/TestModperl/getc.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::getc; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestIO (); 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | untie *STDIN; 17 | tie *STDIN, $r; 18 | 19 | while (my $c = getc) { 20 | die "got more than 1 char" unless length($c) == 1; 21 | $r->puts($c); 22 | } 23 | 24 | untie *STDIN; 25 | 26 | Apache2::Const::OK; 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /t/response/TestModperl/methodname.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::methodname; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | use TestModperl::method (); 13 | 14 | #no : method attribute required when -> config syntax is used 15 | sub response { 16 | TestModperl::method::handler(@_); 17 | } 18 | 19 | 1; 20 | __END__ 21 | PerlResponseHandler TestModperl::methodname->response 22 | -------------------------------------------------------------------------------- /t/response/TestModperl/methodobj.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::methodobj; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::Const -compile => 'OK'; 8 | 9 | use TestModperl::method (); 10 | 11 | our @ISA = qw(TestModperl::method); 12 | 13 | 1; 14 | __END__ 15 | PerlResponseHandler $TestModperl::MethodObj->handler 16 | 17 | -------------------------------------------------------------------------------- /t/response/TestModperl/perl.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::perl; 3 | 4 | # this test includes tests for buggy Perl functions for which mod_perl 5 | # provides a workaround 6 | 7 | use strict; 8 | use warnings FATAL => 'all'; 9 | 10 | use Apache::Test; 11 | use Apache::TestUtil; 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | plan $r, tests => 1; 19 | 20 | ok t_cmp("SNXJvM5I.PJrE", 21 | crypt("testing", "SNXJvM5I.PJrE"), 22 | "crypt"); 23 | 24 | Apache2::Const::OK; 25 | } 26 | 27 | 1; 28 | __END__ 29 | 30 | 31 | -------------------------------------------------------------------------------- /t/response/TestModperl/print.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::print; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestIO (); 8 | 9 | use Apache::Test; 10 | 11 | use Apache2::Const -compile => 'OK'; 12 | 13 | sub handler { 14 | my $r = shift; 15 | 16 | plan $r, tests => 6; 17 | 18 | binmode STDOUT; #Apache2::RequestRec::BINMODE (noop) 19 | 20 | ok 1; 21 | 22 | ok 2; 23 | 24 | { 25 | # print should return true on success, even 26 | # if it sends no data. 27 | my $rc = print ''; 28 | 29 | ok ($rc); 30 | ok ($rc == 0); # 0E0 is still numerically 0 31 | } 32 | 33 | { 34 | my $rc = print "# 11 bytes\n"; # don't forget the newline 35 | 36 | ok ($rc == 11); 37 | } 38 | 39 | printf "ok %d\n", 6; 40 | 41 | Apache2::Const::OK; 42 | } 43 | 44 | END { 45 | my $package = __PACKAGE__; 46 | warn "END in $package, pid=$$\n"; 47 | } 48 | 49 | 1; 50 | -------------------------------------------------------------------------------- /t/response/TestModperl/print_utf8_2.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::print_utf8_2; 3 | 4 | # testing the utf8-encoded response via direct $r->print, which does the 5 | # right thing without any extra provisions. 6 | # see print_utf8.pm for tied STDOUT/perlio STDOUT, which requires extra work 7 | 8 | use strict; 9 | use warnings FATAL => 'all'; 10 | 11 | use Apache2::RequestIO (); 12 | use Apache2::RequestRec (); 13 | 14 | use Apache2::Const -compile => 'OK'; 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | $r->content_type('text/plain; charset=UTF-8'); 20 | 21 | # \x{263A} == :-) 22 | $r->print("\$r->print() just works \x{263A}"); 23 | 24 | Apache2::Const::OK; 25 | } 26 | 27 | 1; 28 | __DATA__ 29 | SetHandler modperl 30 | -------------------------------------------------------------------------------- /t/response/TestModperl/readline.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::readline; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::RequestIO (); 8 | use Apache2::compat (); #XXX 9 | 10 | use Apache::Test; 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | untie *STDIN; 18 | tie *STDIN, $r; 19 | 20 | while (defined(my $line = )) { 21 | $r->puts($line); 22 | } 23 | 24 | untie *STDIN; 25 | 26 | Apache2::Const::OK; 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /t/response/TestModperl/setauth.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::setauth; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::Access (); 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use Apache2::Const -compile => 'OK'; 13 | 14 | sub handler { 15 | my $r = shift; 16 | 17 | plan $r, tests => 2; 18 | 19 | ok t_cmp($r->auth_type(), "none", 'auth_type'); 20 | 21 | t_server_log_error_is_expected(); 22 | $r->get_basic_auth_pw(); 23 | 24 | ok t_cmp($r->auth_type(), 'Basic', 'default auth_type'); 25 | 26 | Apache2::Const::OK; 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /t/response/TestModperl/status.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::status; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Apache2::RequestRec; 8 | use Apache2::Const -compile => qw(DECLINED); 9 | 10 | use ModPerl::Util; 11 | use Apache::TestUtil qw(t_server_log_error_is_expected); 12 | 13 | sub handler { 14 | 15 | my $rc = shift->args; 16 | 17 | if ($rc eq 'die' || 18 | $rc eq Apache2::Const::DECLINED || 19 | $rc =~ m/foo/) { 20 | t_server_log_error_is_expected(); 21 | } 22 | 23 | ModPerl::Util::exit if $rc eq 'exit'; 24 | 25 | die if $rc eq 'die'; 26 | 27 | return if $rc eq 'undef'; 28 | 29 | return $rc; 30 | } 31 | 32 | 1; 33 | __END__ 34 | -------------------------------------------------------------------------------- /t/response/TestModperl/stdfd.pm: -------------------------------------------------------------------------------- 1 | package TestModperl::stdfd; 2 | 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache2::RequestRec (); 7 | use Apache2::RequestIO (); 8 | use Apache2::SubRequest (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | sub fixup { 13 | my $r = shift; 14 | 15 | $r->handler($r->main ? 'perl-script' : 'modperl'); 16 | return Apache2::Const::OK; 17 | } 18 | 19 | sub handler { 20 | my $r = shift; 21 | 22 | return Apache2::Const::OK if $r->main; 23 | 24 | my @fds=(fileno(STDIN), fileno(STDOUT)); 25 | 26 | $r->lookup_uri($r->uri)->run; 27 | 28 | $r->print("1..2\n"); 29 | $r->print((fileno(STDIN)==$fds[0] ? '' : 'not '). 30 | "ok 1 - fileno(STDIN)=".fileno(STDIN)." expected $fds[0]\n"); 31 | $r->print((fileno(STDOUT)==$fds[1] ? '' : 'not '). 32 | "ok 2 - fileno(STDOUT)=".fileno(STDOUT)." expected $fds[1]\n"); 33 | 34 | return Apache2::Const::OK; 35 | } 36 | 37 | 1; 38 | __DATA__ 39 | PerlModule TestModperl::stdfd 40 | PerlFixupHandler TestModperl::stdfd::fixup 41 | PerlResponseHandler TestModperl::stdfd 42 | -------------------------------------------------------------------------------- /t/response/TestModperl/stdfd2.pm: -------------------------------------------------------------------------------- 1 | package TestModperl::stdfd2; 2 | 3 | use strict; 4 | use warnings FATAL => 'all'; 5 | 6 | use Apache2::RequestRec (); 7 | use Apache2::RequestIO (); 8 | use Apache2::SubRequest (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | sub fixup { 13 | my $r = shift; 14 | 15 | $r->handler($r->main ? 'perl-script' : 'modperl'); 16 | return Apache2::Const::OK; 17 | } 18 | 19 | sub handler { 20 | my $r = shift; 21 | 22 | return Apache2::Const::OK if $r->main; 23 | 24 | local *STDIN; 25 | open STDIN, '<', $INC{'TestModperl/stdfd2.pm'} 26 | or die "Cannot open $INC{'TestModperl/stdfd2.pm'}"; 27 | scalar readline STDIN for(1..2); 28 | 29 | my $expected=$.; 30 | 31 | $r->lookup_uri($r->uri)->run; 32 | 33 | $r->print("1..1\n"); 34 | $r->print(($.==$expected ? '' : 'not '). 35 | "ok 1 - \$.=$. expected $expected\n"); 36 | 37 | return Apache2::Const::OK; 38 | } 39 | 40 | 1; 41 | __DATA__ 42 | PerlModule TestModperl::stdfd2 43 | PerlFixupHandler TestModperl::stdfd2::fixup 44 | PerlResponseHandler TestModperl::stdfd2 45 | -------------------------------------------------------------------------------- /t/response/TestModperl/taint.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::taint; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache::Test; 8 | use Apache::TestUtil; 9 | 10 | use Apache2::RequestIO (); 11 | use Apache2::RequestUtil (); 12 | use Apache2::Build (); 13 | 14 | use Apache2::Const -compile => 'OK'; 15 | 16 | my $build = Apache2::Build->build_config; 17 | 18 | sub handler { 19 | my $r = shift; 20 | 21 | my $tests = $build->{MP_COMPAT_1X} ? 4 : 2; 22 | 23 | plan $r, tests => $tests; 24 | 25 | ok t_cmp(${^TAINT}, 1, "\${^TAINT}"); 26 | 27 | eval { ${^TAINT} = 0 }; 28 | ok t_cmp($@, qr/read-only/, "\${^TAINT} is read-only"); 29 | 30 | if ($build->{MP_COMPAT_1X}) { 31 | ok t_cmp($Apache2::__T, 1, "\$Apache2::__T"); 32 | 33 | eval { $Apache2::__T = 0 }; 34 | ok t_cmp($@, qr/read-only/, "\$Apache2::__T is read-only"); 35 | } 36 | 37 | Apache2::Const::OK; 38 | } 39 | 40 | 1; 41 | __END__ 42 | -------------------------------------------------------------------------------- /t/response/TestModperl/util.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModperl::util; 3 | 4 | # Modperl::Util tests 5 | 6 | use strict; 7 | use warnings FATAL => 'all'; 8 | 9 | use Apache::Test; 10 | use Apache::TestUtil; 11 | 12 | use ModPerl::Util (); 13 | 14 | use Apache2::Const -compile => 'OK'; 15 | 16 | sub handler { 17 | my $r = shift; 18 | 19 | plan $r, tests => 1; 20 | 21 | ok t_cmp ModPerl::Util::current_perl_id(), qr/0x\w+/, 22 | "perl interpreter id"; 23 | 24 | Apache2::Const::OK; 25 | } 26 | 27 | 1; 28 | __END__ 29 | -------------------------------------------------------------------------------- /t/response/TestModules/cgipost.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModules::cgipost; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::compat (); 8 | use CGI (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | $r->content_type('text/plain'); 16 | my $cgi = CGI->new; 17 | 18 | print join ":", map { $cgi->param($_) } $cgi->param; 19 | 20 | Apache2::Const::OK; 21 | } 22 | 23 | 1; 24 | __END__ 25 | SetHandler perl-script 26 | PerlOptions +GlobalRequest 27 | -------------------------------------------------------------------------------- /t/response/TestModules/cgipost2.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModules::cgipost2; 3 | 4 | # this handler doesn't use the :Apache layer, so CGI.pm needs to do 5 | # $r->read(...) instead of read(STDIN,...) 6 | 7 | use strict; 8 | use warnings FATAL => 'all'; 9 | 10 | use Apache2::compat (); 11 | use CGI (); 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | $r->content_type('text/plain'); 19 | my $cgi = CGI->new($r); 20 | 21 | $r->print(join ":", map { $cgi->param($_) } $cgi->param); 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | __END__ 28 | 29 | -------------------------------------------------------------------------------- /t/response/TestModules/cgiupload.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModules::cgiupload; 3 | 4 | use strict; 5 | use warnings FATAL => 'all'; 6 | 7 | use Apache2::compat (); 8 | use CGI (); 9 | 10 | use Apache2::Const -compile => 'OK'; 11 | 12 | sub handler { 13 | my $r = shift; 14 | 15 | my $cgi = CGI->new; 16 | 17 | my $file = $cgi->param('filename'); 18 | 19 | while (<$file>) { 20 | print; 21 | } 22 | 23 | Apache2::Const::OK; 24 | } 25 | 26 | 1; 27 | __END__ 28 | SetHandler perl-script 29 | PerlOptions +GlobalRequest 30 | -------------------------------------------------------------------------------- /t/response/TestModules/cgiupload2.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestModules::cgiupload2; 3 | 4 | # this handler doesn't use the :Apache layer, so CGI.pm needs to do 5 | # $r->read(...) instead of read(STDIN,...) 6 | 7 | use strict; 8 | use warnings FATAL => 'all'; 9 | 10 | use Apache2::compat (); 11 | use CGI (); 12 | 13 | use Apache2::Const -compile => 'OK'; 14 | 15 | sub handler { 16 | my $r = shift; 17 | 18 | my $cgi = CGI->new($r); 19 | 20 | local $\; 21 | local $/; 22 | my $file = $cgi->param('filename'); 23 | $r->print(<$file>); 24 | 25 | Apache2::Const::OK; 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/response/TestPerl/ithreads_args.pm: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | package TestPerl::ithreads_args; 3 | 4 | # reproducing a bug in perl ithreads: [perl #34342] 5 | # https://rt.perl.org/rt3/Ticket/Display.html?id=34342 6 | # 7 | # here an unshifted $r (i.e. as it leaves @_ populated causes a scalar 8 | # leak in the thread). 9 | 10 | use Devel::Peek; 11 | use Apache::Test; 12 | 13 | sub handler { # XXX: unshifted $_[0] leaks scalar 14 | #Dump $_[0]; 15 | #my $r = shift; # shift removes the leak 16 | my $r = $_[0]; 17 | #Dump $r; # here PADBUSY,PADMY prevent the ithread from cloning it 18 | 19 | plan $r, tests => 1, need 20 | need_threads, 21 | {"perl >= 5.8.1 is required (this is $])" => ($] >= 5.008001)}; 22 | 23 | require threads; 24 | 25 | warn "\n*** The following leak is expected (perl bug #34342) ***\n"; 26 | threads->new(sub {})->join; 27 | 28 | ok 1; 29 | 30 | return 0; 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /t/user/README: -------------------------------------------------------------------------------- 1 | This directory contains userspace tests, such as those that excercise 2 | non-unit, multiple-API tests, or Apache integration tests, etc. 3 | -------------------------------------------------------------------------------- /t/user/rewrite.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | use Apache::TestRequest qw(GET_BODY_ASSERT); 6 | use Apache::Test; 7 | use Apache::TestUtil; 8 | 9 | my $module = 'TestUser::rewrite'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug("connecting to $url"); 13 | print GET_BODY_ASSERT $url; 14 | -------------------------------------------------------------------------------- /t/vhost/config.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | # the handler is configured in modperl_extra.pl via 3 | # Apache2::ServerUtil->server->add_config 4 | 5 | use Apache::Test; 6 | use Apache::TestUtil; 7 | use Apache::TestRequest 'GET'; 8 | 9 | my $module = 'TestVhost::config'; 10 | my $url = Apache::TestRequest::module2url($module); 11 | 12 | t_debug("connecting to $url"); 13 | my $res = GET $url; 14 | 15 | if ($res->is_success) { 16 | print $res->content; 17 | } 18 | else { 19 | if ($res->code == 404) { 20 | my $docroot = Apache::Test::vars('documentroot'); 21 | die "this test gets its configuration added via " . 22 | "$docroot/vhost/startup.pl, this could be the cause " . 23 | "of the failure"; 24 | } 25 | else { 26 | die "server side has failed (response code: ", $res->code, "),\n", 27 | "see t/logs/error_log for more details\n"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /t/vhost/log.t: -------------------------------------------------------------------------------- 1 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 2 | use Apache::TestUtil; 3 | use Apache::TestRequest 'GET_BODY_ASSERT'; 4 | 5 | my $module = 'TestVhost::log'; 6 | my $url = Apache::TestRequest::module2url($module); 7 | 8 | t_debug("connecting to $url"); 9 | print GET_BODY_ASSERT $url; 10 | 11 | -------------------------------------------------------------------------------- /todo/2.0.6: -------------------------------------------------------------------------------- 1 | SHOW STOPPERS 2 | ==================== 3 | - Windows Segfaults [needs windows developer owner, ] 4 | - MANIFEST verifications [needs detail, ] 5 | - rt.cpan.org PRs [pgollucci, phred, ] 6 | 7 | NICE TO HAVE 8 | ============= 9 | - Smolder, https://issues.apache.org/jira/browse/INFRA-1612 [pgollucci, ] 10 | 11 | -------------------------------------------------------------------------------- /todo/README: -------------------------------------------------------------------------------- 1 | this directory contains notes on whats left to be done: 2 | 3 | release - showstopper issues for mod_perl 2.0 release 4 | 5 | features_* - 6 | 7 | bugs_* - 8 | 9 | docs - docs todo 10 | -------------------------------------------------------------------------------- /todo/bugs_mp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/mod_perl/ead5012b9f8bca08415f39e15226dbc6112a9538/todo/bugs_mp -------------------------------------------------------------------------------- /todo/bugs_registry: -------------------------------------------------------------------------------- 1 | ########################## 2 | # Registry specific bugs # 3 | ########################## 4 | 5 | 6 | * An open issue with chdir, which is process-scoped. Arthur Bergman 7 | has started the work on ex::threads::safecwd, which is discussed 8 | here: http://www.perl.com/pub/a/2002/06/11/threads.html?page=2 9 | 10 | RegistryLoader: 11 | 12 | - chdir() needs to be adjusted when RegistryCooker implements it 13 | 14 | RegistryCooker: 15 | 16 | - consider not to use $$ in debug tracing. Not all platforms give out 17 | a different pid for different threads. 18 | 19 | - some problems with setting the DEBUG() constant based on the value of 20 | Apache->server->dir_config('ModPerl::RegistryCooker::DEBUG') 21 | -------------------------------------------------------------------------------- /todo/docs: -------------------------------------------------------------------------------- 1 | docs todo is located at modperl-docs/src/docs/2.0/TODO 2 | -------------------------------------------------------------------------------- /todo/features_deprecated: -------------------------------------------------------------------------------- 1 | these features with either: 2 | a) never be in 2.0 3 | b) only be in #ifdef MP_DEPRECATED 4 | c) be a form that was nothing like 1.xx (e.g. Apache::Leak) 5 | d) split off into something standalone on cpan 6 | 7 | - MaxModPerlRequestsPerChild 8 | 9 | - $r->seqno, $r->sent_header, 10 | $r->query_string, $r->basic_http_header, $r->new_read, 11 | $r->write_client, $r->read_client_block, $r->translate_name 12 | 13 | - $r->content, $r->args in-a-list-context (exist in Apache::compat) 14 | 15 | - $Apache::Server::Starting, $Apache::Server::ReStarting 16 | 17 | - modules: 18 | + Apache::SIG: dead 19 | + Apache::Symbol: unknown 20 | + Apache::Leak: could be made useful 21 | + Apache::RedirectLogFix: dead 22 | + Apache::Include: was just an example 23 | + Apache::Debug: could be make useful 24 | + Apache::FakeRequest: should be built in 25 | + Apache::httpd_conf: dead (to be replaced by new test framework) 26 | + Apache::Symdump: unknown 27 | + Apache::Opcode: was experimental, needs much attention to be 28 | useful 29 | -------------------------------------------------------------------------------- /todo/tests_wanted: -------------------------------------------------------------------------------- 1 | ################# 2 | # wanted tests # 3 | ################# 4 | 5 | - test that we properly set the error-notes tably entry on 6 | HTTP_INTERNAL_SERVER_ERROR (is sub-request check REDIRECT_ERROR_NOTES) 7 | o test with plain handlers 8 | o test with registry (as we set it twice? once in registry and once 9 | more in the handlers?) 10 | 11 | mp1 has some sort of related test in t/net/perl/server_error.pl: 12 | my $note = $r->prev->notes('error-notes') 13 | 14 | - We can put Apache::Scoreboard to a good use for Apache::Test. For 15 | example we can test with it Apache::SizeLimit or 16 | Apache::Watchdog::RunAway, since both kill processes, and we need to 17 | make sure that the process went away. 18 | -------------------------------------------------------------------------------- /util/cvsize.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | #get an idea of how much space the XS interface will eat 5 | #build/source_scan.pl must be run first 6 | #see pod/modperl_sizeof.pod 7 | 8 | use strict; 9 | use Apache2::FunctionTable (); 10 | use Apache2::StructureTable (); 11 | 12 | use constant sizeofCV => 254; 13 | 14 | my $size = 0; 15 | my $subs = 0; 16 | 17 | for my $entry (@$Apache2::FunctionTable) { 18 | $size += sizeofCV + ((length($entry->{name}) + 1) * 2); 19 | $subs++; 20 | } 21 | 22 | for my $entry (@$Apache2::StructureTable) { 23 | my $elts = $entry->{elts} || []; 24 | next unless @$elts; 25 | 26 | for my $e (@$elts) { 27 | $size += sizeofCV + ((length($e->{name}) + 1) * 2); 28 | $subs++; 29 | } 30 | } 31 | 32 | print "$subs subs, $size estimated bytes\n"; 33 | -------------------------------------------------------------------------------- /util/getdiff.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # this script creates a diff against SVN 5 | # and against /dev/null for all files in ARGV 6 | # and prints it to STDOUT 7 | # 8 | # e.g. 9 | # getdiff.pl t/modules/newtest t/response/TestModules/NewTest.pm \ 10 | # > newtest.patch 11 | # 12 | # the generated patch can be applied with 13 | # patch -p0 < newtest.patch 14 | 15 | # cvs diff 16 | my $o = `svn diff`; 17 | 18 | for (@ARGV) { 19 | $o .= "\n"; 20 | $o .= `diff -u /dev/null $_` 21 | } 22 | 23 | print $o; 24 | 25 | -------------------------------------------------------------------------------- /util/perl_bloat.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- 3 | 4 | # perlbloat.pl 'some perlcode' 'more perl code' 5 | # perlbloat.pl Foo/Bar.pm Bar/Tar.pm 6 | # perlbloat.pl Foo::Bar Bar::Tar 7 | 8 | no warnings; 9 | 10 | use GTop (); 11 | 12 | my $gtop = GTop->new; 13 | 14 | my $total = 0; 15 | for (@ARGV) { 16 | 17 | my $code = $_; 18 | file2package($_) if /\S+\.pm$/; 19 | 20 | my $before = $gtop->proc_mem($$)->size; 21 | 22 | if (eval "require $_" ) { 23 | eval { 24 | $_->import; 25 | }; 26 | } 27 | else { 28 | eval $_; 29 | die $@ if $@; 30 | } 31 | 32 | my $after = $gtop->proc_mem($$)->size; 33 | printf "%-30s added %s\n", $_, GTop::size_string($after - $before); 34 | $total += $after - $before; 35 | } 36 | 37 | print "-" x 46, "\n"; 38 | printf "Total added %30s\n", GTop::size_string($total); 39 | 40 | sub file2package { 41 | $_[0] =~ s|/|::|g; 42 | $_[0] =~ s|\.pm$||; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /xs/APR/Const/Const.xs: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mod_perl.h" 18 | #include "modperl_const.h" 19 | 20 | MODULE = APR::Const PACKAGE = APR::Const 21 | 22 | PROTOTYPES: disable 23 | 24 | BOOT: 25 | MP_newModPerlConstXS("APR"); 26 | 27 | -------------------------------------------------------------------------------- /xs/APR/Const/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | use Apache2::Build; 4 | 5 | my $build = Apache2::Build->build_config(); 6 | my $ccopts = $build->ccopts; 7 | 8 | # avoid referencing &perl_module outside of mod_perl 9 | $ccopts .= ' -DMP_IN_XS'; 10 | 11 | ModPerl::BuildMM::WriteMakefile( 12 | NAME => 'APR::Const', 13 | VERSION_FROM => 'Const.pm', 14 | CCFLAGS => $ccopts, 15 | ); 16 | -------------------------------------------------------------------------------- /xs/APR/Error/APR__Error.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define mpxs_APR__Error_strerror(rc) modperl_error_strerror(aTHX_ rc) 18 | 19 | /* 20 | * Local Variables: 21 | * c-basic-offset: 4 22 | * indent-tabs-mode: nil 23 | * End: 24 | */ 25 | -------------------------------------------------------------------------------- /xs/APR/Lock/APR__Lock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Local Variables: 19 | * c-basic-offset: 4 20 | * indent-tabs-mode: nil 21 | * End: 22 | */ 23 | -------------------------------------------------------------------------------- /xs/APR/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | ModPerl::BuildMM::WriteMakefile( 5 | NAME => "APR_build", 6 | VERSION => '0.01' 7 | ); 8 | -------------------------------------------------------------------------------- /xs/APR/PerlIO/PerlIO.xs: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mod_perl.h" 18 | #include "modperl_apr_perlio.h" 19 | 20 | MODULE = APR::PerlIO PACKAGE = APR::PerlIO 21 | 22 | PROTOTYPES: disabled 23 | 24 | BOOT: 25 | modperl_apr_perlio_init(aTHX); 26 | -------------------------------------------------------------------------------- /xs/Apache2/Command/Apache2__Command.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define mpxs_Apache2__Command_next(cmd) \ 18 | (++cmd, ((cmd && cmd->name) ? cmd : NULL)) 19 | 20 | /* 21 | * Local Variables: 22 | * c-basic-offset: 4 23 | * indent-tabs-mode: nil 24 | * End: 25 | */ 26 | -------------------------------------------------------------------------------- /xs/Apache2/Const/Const.xs: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mod_perl.h" 18 | #include "modperl_const.h" 19 | 20 | MODULE = Apache2::Const PACKAGE = Apache2::Const 21 | 22 | PROTOTYPES: disable 23 | 24 | BOOT: 25 | MP_newModPerlConstXS("Apache2"); 26 | -------------------------------------------------------------------------------- /xs/Apache2/Const/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | ModPerl::BuildMM::WriteMakefile( 5 | NAME => 'Apache2::Const', 6 | VERSION_FROM => 'Const.pm', 7 | ); 8 | -------------------------------------------------------------------------------- /xs/Apache2/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | ModPerl::BuildMM::WriteMakefile( 5 | NAME => "Apache2_build", 6 | VERSION => '0.01' 7 | ); 8 | -------------------------------------------------------------------------------- /xs/Apache2/ServerRec/ServerRec_pm: -------------------------------------------------------------------------------- 1 | use Exporter (); 2 | use Apache2::Log (); # Apache2::ServerRec::loads warn 3 | @Apache2::ServerRec::EXPORT_OK = qw(warn); 4 | *Apache2::ServerRec::import = \&Exporter::import; 5 | -------------------------------------------------------------------------------- /xs/Apache2/SubProcess/SubProcess_pm: -------------------------------------------------------------------------------- 1 | use APR::PerlIO (); 2 | -------------------------------------------------------------------------------- /xs/Apache2/Util/Apache2__Util.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define TIME_NOW apr_time_now() 18 | #define DEFAULT_TIME_FORMAT "%a, %d %b %Y %H:%M:%S %Z" 19 | 20 | /* 21 | * Local Variables: 22 | * c-basic-offset: 4 23 | * indent-tabs-mode: nil 24 | * End: 25 | */ 26 | -------------------------------------------------------------------------------- /xs/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | ModPerl::BuildMM::WriteMakefile( 5 | NAME => "ModPerl::XS", 6 | VERSION => '0.01' 7 | ); 8 | -------------------------------------------------------------------------------- /xs/ModPerl/Const/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | my $srcdir = '../../../src/modules/perl'; 5 | #link these two into Const.so so constants can be used outside of httpd 6 | my @names = map { "modperl_$_" } qw(const constants); 7 | my(@obj, @clean, %src); 8 | 9 | for (@names) { 10 | push @obj, join '.', $_, 'o'; 11 | my $cfile = join '.', $_, 'c'; 12 | push @clean, $cfile; 13 | $src{$cfile} = "$srcdir/$cfile"; 14 | } 15 | 16 | ModPerl::BuildMM::WriteMakefile( 17 | NAME => 'ModPerl::Const', 18 | VERSION_FROM => 'Const.pm', 19 | OBJECT => "Const.o @obj", 20 | clean => { FILES => "@clean" }, 21 | ); 22 | 23 | sub MY::postamble { 24 | my $self = shift; 25 | my $string = $self->ModPerl::BuildMM::MY::postamble; 26 | 27 | $string .= join '', map { 28 | "$_: $src{$_}\n\t\$(CP) $src{$_} .\n"; 29 | } sort keys %src; 30 | 31 | return $string; 32 | } 33 | -------------------------------------------------------------------------------- /xs/ModPerl/Makefile.PL: -------------------------------------------------------------------------------- 1 | use lib qw(../lib); 2 | use ModPerl::BuildMM (); 3 | 4 | ModPerl::BuildMM::WriteMakefile( 5 | NAME => "ModPerl", 6 | VERSION => '0.01' 7 | ); 8 | -------------------------------------------------------------------------------- /xs/maps/modperl_structures.map: -------------------------------------------------------------------------------- 1 | ########## ModPerl structures ########## 2 | 3 | # for mapping see %ModPerl::MapUtil::disabled_map in 4 | # lib/ModPerl/MapUtil.pm 5 | 6 | #_if_ do {use Apache2::Build; Apache2::Build::PERL_HAS_ITHREADS} 7 | 8 | 9 | < mip 10 | < perl 11 | < num_requests 12 | < flags 13 | - ccfg 14 | < refcnt 15 | - tid 16 | 17 | 18 | 19 | < server 20 | < tipool 21 | < parent 22 | 23 | 24 | 25 | - tiplock 26 | - available 27 | - idle 28 | - busy 29 | < in_use 30 | < size 31 | - data 32 | < cfg 33 | - func 34 | 35 | 36 | 37 | < start 38 | < min_spare 39 | < max_spare 40 | < max 41 | < max_requests 42 | 43 | 44 | #_end_ 45 | -------------------------------------------------------------------------------- /xs/maps/modperl_types.map: -------------------------------------------------------------------------------- 1 | ########## mod_perl types ########## 2 | 3 | struct modperl_filter_t | Apache2::OutputFilter 4 | 5 | #_if_ do {use Apache2::Build; Apache2::Build::PERL_HAS_ITHREADS} 6 | 7 | struct modperl_interp_t | ModPerl::Interpreter 8 | struct modperl_interp_pool_t | ModPerl::InterpPool 9 | struct modperl_tipool_t | ModPerl::TiPool 10 | struct modperl_tipool_config_t | ModPerl::TiPoolConfig 11 | PerlInterpreter * | IV 12 | 13 | #_end_ 14 | 15 | ########## Perl types ########## 16 | 17 | SV * | SV 18 | I32 | IV 19 | I32 * | IV 20 | U16 | UV 21 | U16 * | UV 22 | U32 | UV 23 | U32 * | UV 24 | 25 | --------------------------------------------------------------------------------