aboutsummaryrefslogtreecommitdiff
path: root/captain/gemini.f90
diff options
context:
space:
mode:
Diffstat (limited to 'captain/gemini.f90')
-rw-r--r--captain/gemini.f9015
1 files changed, 14 insertions, 1 deletions
diff --git a/captain/gemini.f90 b/captain/gemini.f90
index ff83554..6070dbe 100644
--- a/captain/gemini.f90
+++ b/captain/gemini.f90
@@ -32,6 +32,7 @@ contains
subroutine read_request(ssl, req)
use jessl, only: ssl_read
use iso_c_binding
+ use logging
implicit none
type(c_ptr)::ssl
@@ -44,8 +45,9 @@ contains
req = " "
i = 1
-
+ call sleep(1)
bufread = ssl_read(ssl, buf)
+
do while(bufread > 0)
do j = 1, bufread
@@ -60,6 +62,11 @@ contains
end do
+ if(j > bufread) then
+ j = bufread
+ end if
+
+
if(buf(j) == c_new_line) then
exit
end if
@@ -67,6 +74,8 @@ contains
bufread = ssl_read(ssl, buf)
end do
+ call write_log("Request Read: "//trim(req), LOG_DEBUG)
+
end subroutine read_request
function read_into_buffer(unit_number, buffer)
@@ -288,6 +297,7 @@ contains
call req%path_component(1, first)
if(trim(first) == 'api') then
call write_log("API call encountered", LOG_DEBUG)
+
if(req%protocol == "gemini") then
resp = api_request_gemini(req)
call write_log("resp filename is: '"//trim(resp%body_filename)//"'", LOG_DEBUG)
@@ -295,13 +305,16 @@ contains
call treq%init_from_request(req, ssl)
resp = api_request_titan(treq)
end if
+
else
+
if(req%protocol == "gemini") then
resp = external_request_gemini(req)
else if(req%protocol == "titan") then
call treq%init_from_request(req, ssl)
resp = external_request_titan(treq)
end if
+
end if
call write_log("Handling response", LOG_DEBUG)