From 8da227ca130355332fc92935cfbabc87bd0db078 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 30 Mar 2021 11:23:27 -0400 Subject: Storing an example site. Added support for just plain old static files and favicons --- captain/response.f90 | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'captain/response.f90') 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 -- cgit v1.2.3