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. --- common/protocol.f90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'common/protocol.f90') diff --git a/common/protocol.f90 b/common/protocol.f90 index cf93b0d..25050cb 100644 --- a/common/protocol.f90 +++ b/common/protocol.f90 @@ -151,8 +151,8 @@ contains response_line_index = 0 bytes_received = retrieve_characters(conn%ssl, buffer) - do while(bytes_received > 0) + do while(bytes_received > 0) do i=1, bytes_received if(.not. response_line_completed) then response_line_index = response_line_index + 1 @@ -286,14 +286,17 @@ contains !Print *, "bytes read for sending: ", bytes_read - do while(bytes_read > 0) + bytes_written = 0 + do while(bytes_read > 0 .and. bytes_written >= 0) bytes_written = ssl_write(conn%ssl, buffer(1:bytes_read)) total_written = total_written + bytes_written bytes_read = read_into_buffer(unit_number, buffer) !Print *, "bytes read for sending now: ", bytes_read, " and so far, we wrote", total_written end do - if(total_written >= file_length) then + if(total_written >= file_length .and. bytes_written >= 0) then + + Print *, "Upload ok: ", total_written, file_length response_line_completed = .false. response_line = " " @@ -321,6 +324,7 @@ contains end do else + Print *, "Marking localfail" returncode = STATUS_LOCALFAIL end if -- cgit v1.2.3