aboutsummaryrefslogtreecommitdiff
path: root/captain/response.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/response.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/response.f90')
-rw-r--r--captain/response.f9027
1 files changed, 21 insertions, 6 deletions
diff --git a/captain/response.f90 b/captain/response.f90
index efc8655..5463978 100644
--- a/captain/response.f90
+++ b/captain/response.f90
@@ -90,6 +90,7 @@ contains
end subroutine request_init
subroutine request_component(self, i_component, res)
+ use logging
implicit none
class(request) :: self
@@ -107,8 +108,10 @@ contains
do while(i /= i_last .and. j < i_component)
j = j + 1
+ call write_log("RC: "//self%location(i:n))
+
i_last = i
- i = index(self%location(i_last:n), "/")
+ i = index(self%location(i_last+1:n), "/")
i = i_last + i
end do
@@ -116,6 +119,7 @@ contains
if(j == i_component) then
if(i == i_last) then
res = self%location(i_last+1:n)
+ call write_log("Last! "//trim(res))
else
res = self%location(i_last+1:i-1)
end if
@@ -129,14 +133,25 @@ contains
class(request) :: self
character(*), intent(out)::res
- integer::i
-
- i = index(self%location, "/", back=.true.)
+ integer::i, n
- if(i == len_trim(self%location)) then
+ n = len_trim(self%location)
+ if(n == 1) then
res = "/"
else
- res = self%location((i+1):len_trim(res))
+
+ i = index(self%location, "/", back=.true.)
+
+ if(i == n) then
+ i = index(self%location(1:n-1), "/", back=.true.)
+ if(i > 0) then
+ res = self%location(i+1:n-1)
+ else
+ res = "/"
+ end if
+ else
+ res = self%location((i+1):n)
+ end if
end if
end subroutine request_last_component