summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TO_FIX.md5
-rwxr-xr-xgmi.pl12
2 files changed, 12 insertions, 5 deletions
diff --git a/TO_FIX.md b/TO_FIX.md
index 0a51032..16f30ee 100644
--- a/TO_FIX.md
+++ b/TO_FIX.md
@@ -6,9 +6,6 @@ gmi.pl needs to accept an arguemnt, where the config.toml is located.
remove magic numbers
-in dir_listing, if a file has white space, then it will not properly display.
-server does not do anything with '%20' (whitespace) in path at all.
-
Be able to listen on more ports and different ip addresses -- make vhost adjustable.
make log output user adjustable
@@ -16,3 +13,5 @@ make log output user adjustable
add client certificate stuff
add gmiaccess stuff
+
+set fork() usage toggleable
diff --git a/gmi.pl b/gmi.pl
index b292ba2..69a87e9 100755
--- a/gmi.pl
+++ b/gmi.pl
@@ -7,7 +7,7 @@ use warnings;
use 5.010;
#use diagnostics;
-our $VERSION = 'v0.0.5';
+our $VERSION = 'v0.0.6';
# Modules
use IO::Socket::SSL; # CPAN
@@ -15,7 +15,7 @@ use IO::Socket::SSL::Utils; # CPAN
use URL::XS qw(parse_url split_url_path parse_url_query); # CPAN
#use Term::ANSIColor; # Core
use Path::Naive qw(normalize_path); # CPAN
-#use Smart::Comments; # CPAN
+use Smart::Comments; # CPAN
use URI::Encode qw(uri_encode); # CPAN
use IO::Select;
use TOML qw(from_toml);
@@ -500,6 +500,11 @@ sub dir_listing {
if (substr($i,0,1) eq '.') { # dont display hidden files
next;
}
+
+ # convert space into %20
+ # (there is probably an edge-case bug here)
+ $i =~ s/ /%20/g;
+
$doc .= "=> $i";
if (-d "$doc_loc/$i") {
$doc .= '/';
@@ -543,6 +548,9 @@ sub get_request_in_vhost_root {
# remove '..'
$request =~ s/\.\.//g if ($request);
+
+ # convert %20 into space
+ $request =~ s/%20/ /g if ($request);
$r = normalize_path($request) if ($request);