aboutsummaryrefslogtreecommitdiff
path: root/captain/response.f90
diff options
context:
space:
mode:
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