1package HTTP::Proxy::Engine::NoFork; 2use strict; 3 4our @ISA = qw( HTTP::Proxy::Engine ); 5 6__PACKAGE__->make_accessors( 'select' ); 7 8sub start { 9 my $self = shift; 10 my $proxy = $self->proxy; 11 12 $self->select( IO::Select->new( $proxy->daemon ) ); 13 14 # clients will not block the proxy by keeping the connection open 15 $proxy->max_keep_alive_requests( 1 ); 16} 17 18sub run { 19 my $self = shift; 20 my $proxy = $self->proxy; 21 22 # check for new connections 23 for my $fh ( $self->select->can_read() ) { # there's only one, anyway 24 25 # single-process proxy 26 $proxy->serve_connections( $fh->accept ); 27 $proxy->new_connection; 28 } 29} 30 311; 32 33__END__ 34 35=head1 NAME 36 37HTTP::Proxy::Engine::NoFork - A basic, non forking HTTP::Proxy engine 38 39=head1 SYNOPSIS 40 41 use HTTP::Proxy; 42 my $proxy = HTTP::Proxy->new( engine => 'NoFork' ); 43 44=head1 DESCRIPTION 45 46The HTTP::Proxy::Engine::NoFork engine runs the proxy with forking. 47 48This 49 50=head1 METHODS 51 52=over 4 53 54=item start() 55 56Initialise the engine. 57 58=item run() 59 60Implements the non-forking logic by calling $proxy->serve_requests() 61directly. 62 63=back 64 65=head1 SEE ALSO 66 67L<HTTP::Proxy>, L<HTTP::Proxy::Engine>. 68 69=head1 AUTHOR 70 71Philippe "BooK" Bruhat, C<< <book@cpan.org> >>. 72 73=head1 COPYRIGHT 74 75Copyright 2005, Philippe Bruhat. 76 77=head1 LICENSE 78 79This module is free software; you can redistribute it or modify it under 80the same terms as Perl itself. 81 82=cut 83 84