# Detect the distribution in use %global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g' %global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]' %global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release) %global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4}) %global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace}) # Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel %if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl" %global __distinit rhel %endif # Dist tag for Fedora is still "fc" %if "%{__distinit}" == "f" %global __distinit fc %endif # TODO: Improve support for perl(Log::Log4perl) Summary: Extensible (class) oriented internet server Name: perl-Net-Server Version: 2.014 Release: 6.%{__distinit}%{__distvers} License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Net-Server Source0: https://cpan.metacpan.org/modules/by-module/Net/Net-Server-%{version}.tar.gz Patch0: https://github.com/rhandom/perl-net-server/pull/38.patch BuildArch: noarch # Module Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(ExtUtils::MakeMaker) >= 6.30 # Module Runtime BuildRequires: perl(base) BuildRequires: perl(Carp) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Errno) BuildRequires: perl(Exporter) BuildRequires: perl(Fcntl) BuildRequires: perl(File::Temp) BuildRequires: perl(IO::Handle) BuildRequires: perl(IO::Select) BuildRequires: perl(IO::Socket) BuildRequires: perl(IO::Socket::INET) BuildRequires: perl(IO::Socket::IP) BuildRequires: perl(IO::Socket::UNIX) BuildRequires: perl(POSIX) BuildRequires: perl(re) BuildRequires: perl(Scalar::Util) BuildRequires: perl(Socket) BuildRequires: perl(Sys::Syslog) BuildRequires: perl(strict) BuildRequires: perl(Time::HiRes) BuildRequires: perl(vars) BuildRequires: perl(warnings) # Test Suite BuildRequires: perl(constant) BuildRequires: perl(English) BuildRequires: perl(File::Spec::Functions) BuildRequires: perl(FindBin) BuildRequires: perl(lib) BuildRequires: perl(Test::More) # Optional Tests BuildRequires: perl(IO::Multiplex) >= 1.05 BuildRequires: perl(IO::Socket::SSL) >= 1.31 BuildRequires: perl(Net::SSLeay) BuildRequires: perl(Socket6) BuildRequires: perl(threads) # Dependencies %if 0%{?fedora} < 38 && 0%{?rhel} < 10 Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) %endif Requires: perl(Data::Dumper) # IO::Multiplex support is optional, but not including it causes build problems in some packages... Requires: perl(IO::Multiplex) >= 1.05 # IO::Socket::IP is preferred module for IPv6 suupport Requires: perl(IO::Socket::IP) # Avoid doc-file dependencies %{?perl_default_filter} %description "Net::Server" is an extensible, generic Perl server engine. "Net::Server" combines the good properties from "Net::Daemon" (0.34), "NetServer::Generic" (1.03), and "Net::FTPServer" (1.0), and also from various concepts in the Apache Webserver. "Net::Server" attempts to be a generic server as in "Net::Daemon" and "NetServer::Generic". It includes with it the ability to run as an inetd process ("Net::Server::INET"), a single connection server ("Net::Server" or "Net::Server::Single"), a forking server ("Net::Server::Fork"), a preforking server which maintains a constant number of preforked children ("Net::Server::PreForkSimple"), or as a managed preforking server which maintains the number of children based on server load ("Net::Server::PreFork"). In all but the inetd type, the server provides the ability to connect to one or to multiple server ports. "Net::Server" uses ideologies of "Net::FTPServer" in order to provide extensibility. The additional server types are made possible via "personalities" or sub classes of the "Net::Server". By moving the multiple types of servers out of the main "Net::Server" class, the "Net::Server" concept is easily extended to other types (in the near future, we would like to add a "Thread" personality). "Net::Server" borrows several concepts from the Apache Webserver. "Net::Server" uses "hooks" to allow custom servers such as SMTP, HTTP, POP3, etc. to be layered over the base "Net::Server" class. In addition the "Net::Server::PreFork" class borrows concepts of min_start_servers, max_servers, and min_waiting servers. "Net::Server::PreFork" also uses the concept of an flock serialized accept when accepting on multiple ports (PreFork can choose between flock, IPC::Semaphore, and pipe to control serialization). %prep %setup -q -n Net-Server-%{version} # Only initialize existing Net::SSLeay methods %patch -P 0 -p1 # Remove unnecessary exec bits find . -type f -name '*.pm' -exec chmod -c -x {} \; %build perl Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install make pure_install DESTDIR=%{buildroot} find %{buildroot} -type f -name .packlist -delete %{_fixperms} -c %{buildroot} %check make test %files %license LICENSE %doc Changes examples/ README %{_bindir}/net-server %{perl_vendorlib}/Net/ %{_mandir}/man1/net-server.1* %{_mandir}/man3/Net::Server.3* %{_mandir}/man3/Net::Server::Daemonize.3* %{_mandir}/man3/Net::Server::Fork.3* %{_mandir}/man3/Net::Server::HTTP.3* %{_mandir}/man3/Net::Server::INET.3* %{_mandir}/man3/Net::Server::Log::Log::Log4perl.3* %{_mandir}/man3/Net::Server::Log::Sys::Syslog.3* %{_mandir}/man3/Net::Server::MultiType.3* %{_mandir}/man3/Net::Server::Multiplex.3* %{_mandir}/man3/Net::Server::PreFork.3* %{_mandir}/man3/Net::Server::PreForkSimple.3* %{_mandir}/man3/Net::Server::Proto.3* %{_mandir}/man3/Net::Server::Proto::SSL.3* %{_mandir}/man3/Net::Server::Proto::SSLEAY.3* %{_mandir}/man3/Net::Server::Proto::TCP.3* %{_mandir}/man3/Net::Server::Proto::UDP.3* %{_mandir}/man3/Net::Server::Proto::UNIX.3* %{_mandir}/man3/Net::Server::Proto::UNIXDGRAM.3* %{_mandir}/man3/Net::Server::PSGI.3* %{_mandir}/man3/Net::Server::SIG.3* %{_mandir}/man3/Net::Server::Single.3* %{_mandir}/man3/Net::Server::Thread.3* %changelog * Tue Sep 17 2024 Paul Howarth - 2.014-6 - Only initialize existing Net::SSLeay methods - https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine - https://rt.cpan.org/Public/Bug/Display.html?id=154333 - https://github.com/rhandom/perl-net-server/pull/38 * Wed Mar 15 2023 Paul Howarth - 2.014-1 - Update to 2.014 - Apply patch to Fork for UDP (GH#32, GH#33, CPAN RT#146575) - Fix tests on perls without threads * Sat Dec 3 2022 Paul Howarth - 2.013-1 - Update to 2.013 - Update MANIFEST for missing files (CPAN RT#145285) - Add Net::Server::Thread personality - Package LICENSE file * Fri Dec 2 2022 Paul Howarth - 2.012-1 - Update to 2.012 - Default to IO::Socket::IP with continued fallback to IO::Socket::INET6 - Add double_reverse_lookups configuration and code - Clean up hostname lookup under both IO::Socket::IP and IO::Socket::INET6 - Change SSL to use IO::Socket::SSL SSL_startHandshake - Fix semaphore release - Update various POD issues - Finally add register_child method, called if a child process is started - Bugfix Net::Server::PSGI - Allow groups to be comma separated - Allow . in usernames and groups - Allow space in config file values - Retro-actively acknowledge that 2.008 changed default Net::Server::HTTP type to PreFork (and update docs) - Fix Location bounce with other status set - Return status 400 under request_denied_hook in Net::Server::HTTP - More code/documentation typo fixes - Add /simple routes to HTTP and PSGI echo handlers for doing static request samples - Manually install missing SSL test certificate and key (CPAN RT#145285) - Use SPDX-format license tag * Mon Mar 22 2021 Paul Howarth - 2.010-1 - Update to 2.010 - Add SSL_verify_callback - Fix SSLEAY connect spinloop - Various pod typos - Allow for logging to STDOUT for HTTP - Add PATCH verb to HTTP * Mon Jun 29 2020 Paul Howarth - 2.009-9 - Fix tests failing with OpenSSL @SECLEVEL=2 (CPAN RT#126923) * Thu Jun 6 2019 Paul Howarth - 2.009-6 - Perl 5.30 rebuild * Mon Aug 14 2017 Paul Howarth - 2.009-1 - Update to 2.009 - Several long-awaited fixes - Log when a child exits abnormally (CPAN RT#86815) - Added delete-child hook - Add cleanup_dead_child_hook to PreFork server - Removed stray warn - Use File::Temp instead of POSIX::tmpnam - UNIX read_until to allow for SSL under unix sockets - BR: perl-generators unconditionally - BR: perl-interpreter rather than perl * Thu May 25 2017 Paul Howarth - 2.008-8 - Restore compatibility with Perl 5.26.0 - Drop support for EOL distributions prior to F-13 - Drop BuildRoot: and Group: tags - Drop explicit buildroot cleaning in %%install section - Drop explicit %%clean section * Tue Sep 13 2016 Paul Howarth - 2.008-5 - Fix shellbang in net-server script - BR: perl-generators where available - Simplify find command using -delete * Tue May 13 2014 Paul Howarth - 2.008-1 - Update to 2.008 - Long awaited patch for the IO::Socket::SSL default verify mode bug - Add Time::HiRes as a dep - Update to new github hosted repository with all legacy code imported - Beginnings of change to dzil based releases - There are several dozen outstanding bugs that will be addressed in the next release - Classify buildreqs by usage - Drop %%defattr, redundant since rpm 4.4 * Tue Jul 23 2013 Paul Howarth - 2.007-3 - Perl 5.18 rebuild * Thu Jul 4 2013 Paul Howarth - 2.007-2 - Remove the rpm ≥ 4.9 Log4perl filter too - Fix test suite to work with IO::Socket::SSL ≥ 1.950 (CPAN RT#86707) * Thu Jan 10 2013 Paul Howarth - 2.007-1 - Update to 2.007 - Update run_dequeue to clear out signals after fork - Add serialize none for PreFork and PreForkSimple servers that are not multi-port - Allow for auto-assigned port to be the same when hostname resolves to multiple ips/ipvs (CPAN RT#78024) - Fix bug in header parsing (CPAN RT#82125) - Fix warning bug (CPAN RT#78828) - Fix wrong wantarray context in Proto::TCP (CPAN RT#31437) - Simplify _get_commandline to just use $0 - no fishing in proc (CPAN RT#80260) - Fix uninitialized begin (CPAN RT#78830) - Fix misplaced +2 (CPAN RT#78827) - Fix various spelling errors and pod nits (CPAN RT#77994) - Allow for log calls from the MUX object (CPAN RT#78514) - Give an error at begin time of SSLEAY if the needed Fcntl function is not available on this platform (CPAN RT#82542) - Make all of the tests self cancel much earlier if there is an error handling the request - Add a stronger timeout to PreFork tests - ideally we'd like to find a real way to test these on windows (CPAN RT#81141, #81993) - still broken - but shouldn't hang - Superficial changes to help packagers not list Log4perl as dependency (it is optional) - Drop requires filter for Log4perl, no longer needed * Thu Jun 21 2012 Paul Howarth - 2.006-1 - Update to 2.006 - Allow for case where host is *, and IO::Socket::INET6 is installed, but IPv6 doesn't really work - Add missing child_init_hook in Fork server (so Fork can be more parallel with PreFork in some respects) - Change BOUND_SOCKETS passing to use ; as a separator rather than a \n * Wed Jun 13 2012 Paul Howarth - 2.005-1 - Update to 2.005 - NOTE: ipv now defaults to * - Change the default of ipv from 4 to *; this means if a host of * (default), or a named host is used, any available IPv4 OR IPv6 address will be used - Allow for explicit close_client_stdout call - Add dispatch methods and app setup to HTTP - Allow for exec_fork_hook in HTTP - Make sure errors in HTTP use correct logging mechanisms (and do not die un-needed) - Fix 500 call in PSGI - Fix send_header * Sat Jun 9 2012 Paul Howarth - 2.004-1 - Update to 2.004 - NOTE: Version 2.005 will change the default ipv value to * meaning it will attempt to bind IPv4 and IPv6 if they are available if you pass a hostname - Add Net::Server::Proto->get_addr_info, which can more reliably resolve domain information - Use that information to figure out an appropriate host to bind to for tests - Make get_addr_info less reliant on magic values of sysctl net.ipv6.bindv6only - Allow all tests to function in IPv6 only environments - Fix broken number of tests in test suite - Add warnings about changes to the default value of ipv coming in 2.005 * Thu Jun 7 2012 Paul Howarth - 2.003-1 - Update to 2.003 - Make the logging system pluggable - Added net-server server executor for writing easier one line servers - Sys::Syslog and Log::Log4perl are now moved out to their own module subsystems - Added full apache-style HTTP log formatting for the HTTP server - Allow for ipv to be specified as part of host, or proto, or passed via $ENV{'IPV'} - Add apache-style access logging (access_log_file and access_log_format) to HTTP - Allow HTTP header parsing to not untaint the headers - Fix missing legacy NS_unix_path call (missing since 2.000) - Fix a bug in MultiType that prevented calling server_type HTTP - Filter perl(Log::Log4perl) dependency for now; may sub-package Net::Server::Log::Log::Log4perl at a later date once I can support Log::Log4perl on all distributions * Fri Jun 1 2012 Paul Howarth - 2.002-1 - Update to 2.002 - Make HTTP output header parsing more consistent - and catch more errors - Add exec_cgi and exec_trusted_perl methods to HTTP - Add bugfix for ipv=>"*" combined with UNIX sockets - Fix the SSL_test.t to use exit rather than quit so the parent departs * Wed May 30 2012 Paul Howarth - 2.001-1 - Update to 2.001 - Bring Net::Server::Proto::SSL back; it is now fully functional under all scenarios, including IPv4 and IPv6 - Change Proto interface to allow passing more information; this represents an internal API change - Updates to the HUP mechanisms to make sure we rebind all types of ports correctly - Add IPv6 integration via ::1 style addresses as well as the ipv configuration parameter - Added graceful shutdown - Added hot deploy via TTIN and TTOU - Internal code tidying - Finish up support for connecting to ports by service name - Don't lose track of fork and prefork children on a HUP - make sure to actively wait them off - Correct accept to take a classname, and optionally be called in array context - Clean up numerous configuration issues - Added sig_passthrough option to Fork, PreFork, and PreForkSimple servers allowing for arbitrary signals to propagate to children - Add syswrite/sysread support to SSLeay - Add PSGI module - Many small accumulated bugfixes - Bug fix: wrong usage of File::Temp::tempfile (CPAN RT#77540) - Fix HTTP_COOKIES to be HTTP_COOKIE - Handle multiple header values better in HTTP - Add Log::Log4perl logging - Add buildreqs for test suite: - perl(IO::Socket::INET6) - perl(IO::Socket::SSL) - perl(Net::SSLeay) - perl(Socket6) - Don't need to remove empty directories from buildroot - Drop support for old distributions prior to FC-3: - Don't need to define %%{perl_vendorlib} - Use DESTDIR rather than PERL_INSTALL_ROOT * Tue Jul 5 2011 Paul Howarth - 0.99-2 - Rebuild for perl 5.14.1 in Rawhide - Nobody else likes macros for commands - Fix dist tag for CentOS 6 and Scientific Linux * Mon Jul 19 2010 Paul Howarth - 0.99-1 - Update to 0.99 - Add SSLeay proto - finally a workable SSL solution - Add minimal Net::Server::TiedHandle for STD{IN,OUT} to work with SSLEAY - Net::Server::TiedHandle support tied_stdin_callback & tied_stdout_callback - Allow for port => 0 which lets the OS auto assign a port on some OSes - Add idle_loop_hook to PreForkSimple and PreFork - Add consistent formatting capabilities to the log method - Warn when default listen value is used - try to make it a sensible default - Allow for non-zero exit value - particularly when called from fatal - Add customizable check_for_spawn and min_child_ttl settings in PreFork - Add other_child_died_hook - Make Multiplex do $mux->add($sock) for UDP sockets - Change Net::Server::Daemonize to use kill 0 rather than the unportable `ps` - Fix calling conventions of MultiType - Avoid select in SSLEAY that was allowing for infinite spin loop - Fix tie_stdout mode to not warn about unopen handles - Added Net::Server::HTTP base class for basic HTTP daemon handling - Change examples/httpd to use Net::Server::HTTP - BR: perl(Time::HiRes) * Fri Jun 25 2010 Paul Howarth - 0.97-6 - Rebuild for perl 5.12.1 in Rawhide * Thu Jun 3 2010 Paul Howarth - 0.97-5 - Fix dist tag for RHEL-6 Beta * Mon Mar 1 2010 Paul Howarth - 0.97-4 - Dist tag for Rawhide no longer needs special-casing - Use %%{_fixperms} macro instead of our own %%{__chmod} incantation * Tue Sep 22 2009 Paul Howarth - 0.97-3 - Define RPM macros in global scope * Fri Nov 14 2008 Paul Howarth - 0.97-2 - Tweak dist tag macros to work on current Rawhide with three-part releasenum - Clarify license as GPL version 1 or later, or Artistic (i.e. same as perl) * Thu Jul 26 2007 Paul Howarth - 0.97-1 - Update to 0.97 - BuildRequire perl(ExtUtils::MakeMaker) & perl(Test::More) * Tue Mar 27 2007 Paul Howarth - 0.96-1 - Update to 0.96 * Mon Feb 5 2007 Paul Howarth - 0.95-1 - Update to 0.95 - Fix dist tag for fc7 onwards - Fix argument order for find with -depth - Buildreq perl(IO::Multiplex) for use in test suite * Wed Jul 12 2006 Paul Howarth - 0.94-1 - Update to 0.94 - Define %%{__id_u} in a more portable way * Mon Mar 27 2006 Paul Howarth - 0.93-1 - Update to 0.93 * Thu Mar 23 2006 Paul Howarth - 0.92-1 - Update to 0.92 * Thu Mar 9 2006 Paul Howarth - 0.91-1 - Update to 0.91 - Use search.cpan.org URLs * Mon Jan 9 2006 Paul Howarth - 0.90-2 - Add IO::Multiplex dep as per Fedora Extras * Tue Dec 6 2005 Paul Howarth - 0.90-1 - Update to 0.90 * Thu Nov 24 2005 Paul Howarth - 0.89-1 - Update to 0.89 - Remove redundant compiler optimization settings, not needed for noarch pkg - Don't use macros in paths for build-time commands, hardcode them instead - Simplify distribution-detection - Remove buildroot unconditionally in %%clean and %%install - Fix directory ownership * Wed Jun 22 2005 Paul Howarth - 0.88-1 - Update to 0.88 * Mon May 23 2005 Paul Howarth - 0.87-3 - Rewrite spec file in (mainly) Fedora Extras style - Include full URL for source - Fix URL - Use MODULE_COMPAT dependency style and remove explicit perl dependency * Thu Apr 15 2004 Paul Howarth - 0.87-2 - Added explicit perl dependency to ensure that an RPM built on a system with an updated version of perl (and hence having files installed in a place that a non-updated system won't find them) will not install on the non-updated system; in such cases, just rebuild from the source RPM - Changed distribution-identifying macros for greater portability * Thu Mar 04 2004 Paul Howarth - 0.87-1 - Update to 0.87 - Added GPL as license option * Mon Feb 16 2004 Paul Howarth - 0.86-2 - Unified spec file for Red Hat and Fedora Core * Tue Feb 03 2004 Paul Howarth - 0.86-1.fc1 - Initial RPM build