From 0da710f0f1b89ff7ebdbdc8e6b08edb396419eb6 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Wed, 15 Jan 2020 23:28:23 -0500
Subject: ./minimun includes tested pdf generator, 404 responder, and get
parser
---
minimun | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/minimun b/minimun
index f376d9a..ff00960 100755
--- a/minimun
+++ b/minimun
@@ -5,9 +5,38 @@ use warnings;
use IPC::Run qw(run);
use Time::HiRes qw( time );
+my ($buffer, @pairs, $pair, $name, $val, %FORM);
+
+if ($ENV{'REQUEST_METHOD'} eq "GET") {
+ $buffer = $ENV{'QUERY_STRING'};
+}
+@pairs = split(/&/, $buffer);
+
+foreach $pair (@pairs) {
+ ($name, $val) = split(/=/, $pair);
+ $val =~ tr/+/ /;
+ $val =~ s/%(..)/pack("C", hex($1))/eg;
+ $FORM{$name} = $val;
+}
+
my ($in, $out);
+$in = "\n";
+
+if ($ENV{'PATH_INFO'} eq '/award.pdf'){
+ $in .= "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}";
+}
+elsif ($ENV{'PATH_INFO'} eq '/room.pdf'){
+ $in .= "\\room{$FORM{'committee'}}";
+}
+else{
+ print "Content-type: text/html\n";
+ print "Status: 404 File Not Found Error\n";
+ print "\n";
+ print '404 Error. Go back.';
+ die;
+}
+
-$in .= "\\award\n";
$in .= "\\bye\n";
my $timestamp = time;
--
cgit