From 85a6816e7840e6b8cdff51b7c0cfad36082c01ec Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 7 Apr 2021 15:40:25 -0400 Subject: Results now posted back correctly using titan protocol --- captain/response.f90 | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'captain/response.f90') diff --git a/captain/response.f90 b/captain/response.f90 index 1c7a0b5..9cd2d9f 100644 --- a/captain/response.f90 +++ b/captain/response.f90 @@ -140,8 +140,6 @@ contains do while(i /= i_last .and. j < i_component) j = j + 1 - call write_log("RC: "//self%location(i:n)) - i_last = i i = index(self%location(i_last+1:n), "/") i = i_last + i @@ -151,7 +149,6 @@ contains if(j == i_component) then if(i == i_last) then res = self%location(i_last+1:n) - call write_log("Last! "//trim(res)) else res = self%location(i_last+1:i-1) end if @@ -389,8 +386,8 @@ contains self%location = regular_request%location(1:i-1) size_text => titan_get_request_value(regular_request%location, "size") - read(size_text, *, iostat=ierr) self%size - if(ierr <= 0) then + read(size_text, '(I16)', iostat=ierr) self%size + if(ierr /= 0) then self%size = 0 end if deallocate(size_text) @@ -420,6 +417,7 @@ contains subroutine titan_write_to_filename(self, filename) use jessl, only: ssl_read + use logging implicit none class(titan_request)::self @@ -432,16 +430,26 @@ contains integer(kind=8)::bytes_to_go integer::i - open(newunit=unum, file=filename, status="unknown", action="write", access="stream") + character(128)::msg + + open(newunit=unum, file=filename, status="unknown", action="write", access="stream", form="formatted") bytes_to_go = self%size - + call write_log("Writing!") + do while(bytes_to_go > 0) bufread = ssl_read(self%ssl_connection, buf) bytes_to_go = bytes_to_go - bufread + write(msg, *) "read: ", bufread + call write_log(trim(msg)) + + write(msg, *) "remaining: ", bytes_to_go + call write_log(trim(msg)) + + do i = 1, bufread - write(unum, '(A1)', advance='no') buf(i:i) + write(unum, '(A1)', advance='no') buf(i) end do end do -- cgit v1.2.3