From cd4a5891b8e2a019fdfda7512d6490e075628292 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 29 Jun 2021 16:06:44 -0400 Subject: Tokens are now checked for file uploads. Fixed major buffer bugs in status reporting. --- captain/gemini.f90 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'captain/gemini.f90') 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) -- cgit v1.2.3