aboutsummaryrefslogtreecommitdiff
path: root/captain/external.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-03-30 11:23:27 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-03-30 11:23:27 -0400
commit8da227ca130355332fc92935cfbabc87bd0db078 (patch)
tree8831aad73c70663dbcfca6b34bd0916ef16d6337 /captain/external.f90
parentfbfd194941de48affaa92522ceaff97010abc1c2 (diff)
downloadlevitating-8da227ca130355332fc92935cfbabc87bd0db078.tar.gz
levitating-8da227ca130355332fc92935cfbabc87bd0db078.zip
Storing an example site. Added support for just plain old static files and favicons
Diffstat (limited to 'captain/external.f90')
-rw-r--r--captain/external.f9021
1 files changed, 20 insertions, 1 deletions
diff --git a/captain/external.f90 b/captain/external.f90
index 146060f..5e64bab 100644
--- a/captain/external.f90
+++ b/captain/external.f90
@@ -108,6 +108,7 @@ contains
function is_request_static(req)
use server_response
+ use logging
implicit none
class(request), intent(in)::req
@@ -116,7 +117,13 @@ contains
call req%path_component(1, first)
- is_request_static = ((first == "releases") .or. (first == "uploads"))
+ call write_log("Static check: "//trim(first))
+
+ is_request_static = ((trim(first) == "releases") .or. &
+ (trim(first) == "uploads") .or. &
+ (trim(first) == "results") .or. &
+ (trim(first) == "static") .or. &
+ (trim(first) == "favicon.txt"))
end function is_request_static
@@ -138,17 +145,29 @@ contains
call req%path_component(1, category)
call req%last_component(filename)
+ call write_log("Catgeory: "//trim(category)//" File: "//trim(filename))
+
if(category == "releases") then
allocate(character(len=(len_trim(release_dir)+len_trim(filename)+1)) :: resp%body_filename)
call combine_paths(release_dir, filename, resp%body_filename)
else if(category == "uploads") then
allocate(character(len=(len_trim(release_dir)+len_trim(filename)+1)) :: resp%body_filename)
call combine_paths(release_dir, filename, resp%body_filename)
+ else if(category == "results") then
+ allocate(character(len=(len_trim(results_dir)+len_trim(filename)+1)) :: resp%body_filename)
+ call combine_paths(results_dir, filename, resp%body_filename)
+ else if(category == "static") then
+ allocate(character(len=(len_trim(static_dir)+len_trim(filename)+1)) :: resp%body_filename)
+ call combine_paths(static_dir, filename, resp%body_filename)
+ else if(category == "favicon.txt") then
+ allocate(character(len=(len_trim(static_dir)+len_trim(filename)+1)) :: resp%body_filename)
+ call combine_paths(static_dir, filename, resp%body_filename)
end if
inquire(file=resp%body_filename, exist=exists)
if(.not. exists) then
resp%code = GEMINI_CODE_PERMFAIL
+ call write_log("File did not exist: "//resp%body_filename)
else
resp%code = GEMINI_CODE_SUCCESS