HTTP::Server::EV - Asynchronous HTTP server written in C with request parser.
HTTP::Server::EV - Asynchronous HTTP server using EV event loop. It doesn`t load files received in the POST request in memory as moust of CGI modules does, but stores them directly to tmp files, so it`s useful for handling large files without using a lot of memory.
HTTP::Server::EV::CGI - received http request object HTTP::Server::EV::MultipartFile - received file object HTTP::Server::EV::Buffer - non blocking output HTTP::Server::EV::BufTie - workaround for correct handling requests in Coro threads
use EV; use HTTP::Server::EV; my $server = HTTP::Server::EV->new; $server->listen(90, sub { my $cgi = shift; $cgi->attach(*STDOUT); $cgi->header; print "Just another Perl server\n"; }); EV::loop;
Options:
Directory for saving received files. Tries to create if not found, dies on fail. Default: ./upload_tmpfiles/
Usually HTTP::Server::EV::CGI deletes tmp files on DESTROY, but it might by bug if you delete HTTP::Server::EV::CGI object when its files are still opened. Setting on this flag causes HTTP::Server::EV delete all files in tmp_path on program close, but don`t use it if jou have several process working with same tmp dir. Default: 0
Seting on cause HTTP::Server::EV::CGI parse ip from X-Real-IP http header Default: 0
Binds callback to port. Calls callback and passes HTTP::Server::EV::CGI object in it;
$server->listen( 8080 , sub { my $cgi = shift; $cgi->attach(local *STDOUT); # attach STDOUT to socket $cgi->header; # print http headers to stdout print "Test page"; });
Delete all files in tmp_path. Automatically called on DESTROY if cleanup_on_destroy set
Write tests
Write request parser error handling - Server drops connection on error(Malformed or too large request), but there is no way to know what error happened.
unbind function
You can`t create two HTTP::Server::EV objects at same process.
Static allocated buffers:
- Can`t listen more than 20 ports at same time
- 4kb for GET/POST form field names
- 4kb for GET values
- 50kb for POST form field values ( not for files. Files are stored into tmp directly from socket stream, so filesize not limited by HTTP::Server::EV)
HTTP::Server::EV drops connection if some buffer overflows. You can change these values in EV.xs and recompile module.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTTP::Server::EV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Server::EV
CPAN shell
perl -MCPAN -e shell install HTTP::Server::EV
For more information on module installation, please visit the detailed CPAN module installation guide.