diff options
author | jake <jake@jakes-mail.top> | 2022-08-15 08:56:11 -0400 |
---|---|---|
committer | jake <jake@jakes-mail.top> | 2022-08-15 08:58:13 -0400 |
commit | 9969ee032f73d03ff9dcb5246eced784ce234c87 (patch) | |
tree | 2e14b7edb5803264df5b13364b2a5868f4413dd4 | |
parent | a4e2e344728b5642814877ff908d90d308c33032 (diff) |
Handle space (%20) in path
-rw-r--r-- | TO_FIX.md | 5 | ||||
-rwxr-xr-x | gmi.pl | 12 |
2 files changed, 12 insertions, 5 deletions
@@ -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 @@ -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); |