From c493170e73506e974a0644452fc5a334c08171bc Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 7 Apr 2021 14:21:35 -0400 Subject: Fixed many issues related to reporting status. Initial debugging of titan upload handling. --- captain/gemini.f90 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'captain/gemini.f90') diff --git a/captain/gemini.f90 b/captain/gemini.f90 index 8453db9..db0ac17 100644 --- a/captain/gemini.f90 +++ b/captain/gemini.f90 @@ -58,7 +58,7 @@ contains ierr = 0 i = 0 - do while(ierr == 0 .and. i < len(buffer)) + do while(ierr == 0 .and. i < 64) i = i + 1 read(unit_number, iostat=ierr) buffer(i) end do @@ -86,9 +86,9 @@ contains write(int_text, '(I8)') code line = trim(adjustl(int_text))//" "//trim(meta) - call write_log("Status line: "//trim(line)) + call write_log("Status line: '"//trim(line)//"'") - call write_string(ssl, trim(adjustl(int_text))//" "//trim(meta)//c_carriage_return//c_new_line) + call write_string(ssl, trim(line)//c_carriage_return//c_new_line) end subroutine write_status @@ -106,7 +106,7 @@ contains integer::buflen, written call write_status(ssl, GEMINI_CODE_SUCCESS, mimetype) - + buflen = read_into_buffer(unit_number, buf) do while(buflen > 0) written = ssl_write(ssl, buf(1:buflen)) @@ -267,8 +267,10 @@ contains if(trim(first) == 'api') then if(req%protocol == "gemini") then resp = api_request_gemini(req) + call write_log("resp filename is: '"//trim(resp%body_filename)//"'") else if(req%protocol == "titan") then call treq%init_from_request(req, ssl) + resp = api_request_titan(treq) end if else resp = external_request_gemini(req) @@ -292,15 +294,16 @@ contains form="unformatted", iostat=ioerror, access="stream") call write_file(ssl, rendered_unit, resp%body_mimetype) call write_log("File written") - close(rendered_unit) end select + call write_log("Cleanup") + call req%destroy() call resp%destroy() - + call write_log("shutdown") res = ssl_shutdown(ssl) res = ssl_free(ssl) res = ctx_free(ctx) -- cgit v1.2.3