miyagawa / Starman

Starman is a high-performance preforking Perl PSGI web server
http://search.cpan.org/dist/Starman
Other
287 stars 84 forks source link

Allow SSL when used under Server::Starter #147

Open kgoess opened 1 year ago

kgoess commented 1 year ago

This commit goes along with a PR I'm submitting to p5-Net-Server-SS-PreFork.

It allows you to run starman under start_server like this:

start_server \
    --port 1.1.1.1:111 \
    --port 2.2.2.2:222 \
    -- \
    starman \
    --enable-ssl \
    --ssl_cert ./etc/ccard/kgoess7-sandbox-ccweb.crt \
    --ssl_key ./etc/ccard/kgoess7-sandbox-ccweb.key \
    --net_server_SSL_cipher_list whatever

Or instead of enabling SSL on all the ports, it can be done selectively by adding the ":ssl" suffix to the individual "--port" arguments.

The maybe_upgrade_to_ssl function allows Net::Server::SS::PreFork's pre_bind method to look at $self->{options}, which is where Starman::Server has stashed the SSL arguments.

See also a PR I'm submitting to p5-Server-Starter that allows start_server's --port argument to take an ":ssl" suffix, like "--port IP:PORT:ssl".

miyagawa commented 1 year ago

(Hi!)

The patch looks reasonable to me. I'll wait and see if this is accepted in Server-Starter.