💾 Archived View for 80h.dev › projects › gemserv › files › cgi-scripts › scgi › scgi.pl.gemini captured on 2022-06-12 at 00:48:56. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

01 #!/usr/local/bin/perl

02

03

04 use SCGI;

05 use IO::Socket;

06

07 my $socket = IO::Socket::INET->new(Listen => 5, ReuseAddr => 1, LocalPort => 4001)

08 or die "cannot bind to port 4001: $!";

09

10 my $scgi = SCGI->new($socket, blocking => 1);

11

12 while (my $request = $scgi->accept) {

13 $request->read_env;

14 read $request->connection, my $body, $request->env->{CONTENT_LENGTH};

15 print { $request->connection } "20\ttext/gemini\r\nperl\n";

16 }