NAME

HTTP::Server::Encrypt - HTTP server with encrypt BODY section

SYNOPSIS

use HTTP::Server::Encrypt qw(http_server_start);

my %http_conf;
$http_conf{'port'} = 80;
$http_conf{'username'} = 'username';
$http_conf{'passwd'} = 'passwd';
$http_conf{'min_spare'} = 2;
$http_conf{'max_spare'} = 6;
$http_conf{'static_expires_secs'} = 7200;
$http_conf{'docroot'} = 'plugins/';
$http_conf{'blowfish_key'} = $key;
$http_conf{'blowfish_encrypt'} = 'yes';
$http_conf{'blowfish_decrypt'} = 'yes';
$http_conf{'ip_allow'} = \%ip_allow;
$http_conf{'ip_deny'} = \%ip_deny;

http_server_start(\%http_conf);

DESCRIPTION

A pure Perl WebServer with additional features below.

  • Counld encrypt response BODY section or decrypt resquest BODY section with BlowFish CBC.

  • Support HTTP Basic Authentication.

  • Perfork proccess number can be controlled.

  • Cache static request`s response in memory.

  • Route dynamic requests to file.

  • Built-in IP filter.

  • Support protocol PON (Perl Object Notation).

USAGE

Usage of HTTP::Server::Encrypt is very simple.

http_server_start(%params)

To set up a new HTTP Server, call the http_server_start method. You Get All Done. It will run as a daemon.

http_server_start accepts the following named parameters in %params:

  • port

    The port of the daemon to which you wish to listen on. Defaults to 80.

  • protocol

    http for protocol HTTP. pon for protocol PON.

  • min_spare

    How many child will be forked when the server start.

  • max_spare

    Maximum number of processes can be forked.

  • docroot

    This directive sets the directory from which the server will serve files.

  • cache_expires_secs

    Set the HTTP "Cache-Control: max-age" value.

  • username

    Set the HTTP Basic Authentication username.

  • passwd

    Set the HTTP Basic Authentication password. if username and password are not be set, HTTP Basic Authentication disabled.

  • blowfish_key

    Set the BODY encrpyt key. if not set, BODY encrypt disabled.

  • blowfish_encrypt

    Set enable encrpy the send response BODY section.

  • blowfish_decrypt

    Set enable encrpy the recieved request BODY section.

  • ip_allow

    Set ip list allow acccess.

  • ip_deny

    Set ip list deny access.

  • log_dir

    Set log directory. Disable log if value eq no.

PERFORMANCE

The Module has about more the half of request/sec performance compared to apache 2.2. Your can trade off between req/sec and sec/req using config min_spare and max_spare.

AUTHOR

Written by ChenGang, yikuyiku.com@gmail.com

http://blog.yikuyiku.com/

COPYRIGHT

Copyright (c) 2011 ChenGang. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

HTTP::Daemon, HTTP::Server::Simple