aboutsummaryrefslogtreecommitdiff
path: root/captain/response.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2023-02-08 16:03:23 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2023-02-08 16:03:23 -0500
commit10547ba1064ca5a1dd04e782b0df99a22b60de3f (patch)
tree5368ce2ab9133e0ea1c2f12696dd8043f639e742 /captain/response.f90
parentcf13b8b542cd6eb3c0cf73a2428a7a825dc6252e (diff)
downloadlevitating-10547ba1064ca5a1dd04e782b0df99a22b60de3f.tar.gz
levitating-10547ba1064ca5a1dd04e782b0df99a22b60de3f.zip
Fixed Gemini redirects to keep the session token intact. Might break logging off...
Diffstat (limited to 'captain/response.f90')
-rw-r--r--captain/response.f9024
1 files changed, 18 insertions, 6 deletions
diff --git a/captain/response.f90 b/captain/response.f90
index 49f735e..6d9bf46 100644
--- a/captain/response.f90
+++ b/captain/response.f90
@@ -161,8 +161,13 @@ contains
if(link(1:1) == "/") then
if(present(session_token)) then
if(associated(session_token)) then
- nl = nl + 9 + len_trim(session_token)
- prepend_session = .true.
+
+ ! Make sure the url doesn't already have a session token...
+ if(index(link, "/session-"//trim(session_token)) /= 1) then
+ nl = nl + 9 + len_trim(session_token)
+ prepend_session = .true.
+ end if
+
end if
end if
end if
@@ -736,11 +741,18 @@ contains
implicit none
class(response)::resp
- character(*), intent(in)::str
+ character(*), intent(in), optional::str
- if(len_trim(str) > 0) then
- allocate(character(len=len_trim(str)) :: resp%url)
- resp%url = trim(str)
+ if(associated(resp%url)) then
+ deallocate(resp%url)
+ resp%url => null()
+ end if
+
+ if(present(str)) then
+ if(len_trim(str) > 0) then
+ allocate(character(len=len_trim(str)) :: resp%url)
+ resp%url = trim(str)
+ end if
end if
end subroutine response_set_url