aboutsummaryrefslogtreecommitdiff
path: root/captain/gemini.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-04-07 14:21:35 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-04-07 14:21:35 -0400
commitc493170e73506e974a0644452fc5a334c08171bc (patch)
tree7cfbbde04f5e3263092118dbabf843fbe68d93ad /captain/gemini.f90
parent1de4bd52574599452f9e92c8e36381a4797563fb (diff)
downloadlevitating-c493170e73506e974a0644452fc5a334c08171bc.tar.gz
levitating-c493170e73506e974a0644452fc5a334c08171bc.zip
Fixed many issues related to reporting status. Initial debugging of titan upload handling.
Diffstat (limited to 'captain/gemini.f90')
-rw-r--r--captain/gemini.f9015
1 files changed, 9 insertions, 6 deletions
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)