daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. use strict;
  3. use POE qw(Component::Server::SimpleHTTP XS::Queue::Array Loop::IO_Poll);
  4.  
  5. POE::Component::Server::SimpleHTTP->new(ALIAS => 'HTTPD', PORT => 8010, HANDLERS => [{ DIR => '/', SESSION => 'MANAGER', EVENT => 'req' }]);
  6. POE::Session->create(inline_states => {
  7.     _start => sub { $_[KERNEL]->alias_set('MANAGER') },
  8.     req    => sub {
  9.         for ($_[ARG1]) {
  10.             $_->code(200);
  11.             $_->header('content-type', 'text/plain');
  12.             $_->content($_[ARG0]->uri);
  13.            
  14.             $_[KERNEL]->post('HTTPD' => 'DONE' => $_);
  15.         }
  16.     },
  17. });
  18. POE::Kernel->run;
  19.  
  20. __END__
  21. Requests per second:    469.65 [#/sec] (mean)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top