From d26549e79053413bf82c510c6fb192289fe7448a Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 2 May 2022 11:15:59 -0400 Subject: Added concept of cookies so that sessions could exist in the web interface. Login and logout now work properly. --- captain/queryutils.f90 | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'captain/queryutils.f90') 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 -- cgit v1.2.3