diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2022-05-02 11:15:59 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2022-05-02 11:15:59 -0400 |
commit | d26549e79053413bf82c510c6fb192289fe7448a (patch) | |
tree | 107f76ff094790df116666292fb3dcfcba97a14c /captain/queryutils.f90 | |
parent | 8c401f9748069eb052f5ac4f2eee1761b1f67afd (diff) | |
download | levitating-d26549e79053413bf82c510c6fb192289fe7448a.tar.gz levitating-d26549e79053413bf82c510c6fb192289fe7448a.zip |
Added concept of cookies so that sessions could exist in the web interface. Login and logout now work properly.
Diffstat (limited to 'captain/queryutils.f90')
-rw-r--r-- | captain/queryutils.f90 | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/captain/queryutils.f90 b/captain/queryutils.f90 index c6b612b..3a736dd 100644 --- a/captain/queryutils.f90 +++ b/captain/queryutils.f90 @@ -54,6 +54,14 @@ implicit none end type query + type, extends(query) :: cookies + + contains + + procedure :: init => cookies_init + + end type cookies + contains subroutine query_component_parse(self, comptext) @@ -128,11 +136,12 @@ contains end function query_component_has_key - subroutine query_init(self, str) + subroutine query_init_generic(self, separator, str) use logging implicit none class(query), intent(out)::self + character::separator character(len=*), intent(in), optional::str character(64)::msg @@ -154,7 +163,7 @@ contains ampersands = 0 do i = 1, len(self%full) - if(self%full(i:i) == '&') then + if(self%full(i:i) == separator) then ampersands = ampersands + 1 end if end do @@ -183,8 +192,36 @@ contains end if + end subroutine query_init_generic + + subroutine query_init(self, str) + implicit none + + class(query)::self + character(len=*), intent(in), optional::str + + if(present(str)) then + call query_init_generic(self, "&", str) + else + call query_init_generic(self, "&") + end if + end subroutine query_init + subroutine cookies_init(self, str) + implicit none + + class(cookies)::self + character(len=*), intent(in), optional::str + + if(present(str)) then + call query_init_generic(self, ";", str) + else + call query_init_generic(self, ";") + end if + + end subroutine cookies_init + pure function query_component_count(self) implicit none |