From 05b91a7ca0aace044621d8db1e82f4772181d893 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 14 Apr 2021 10:54:27 -0400 Subject: Fixed binary transfers to maintain file integrity. Added globbed file upload capabilities. Fixed memory overrun issues due to problems parsing ls output. --- common/request.f90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'common/request.f90') diff --git a/common/request.f90 b/common/request.f90 index d7b3120..fe4d970 100644 --- a/common/request.f90 +++ b/common/request.f90 @@ -218,7 +218,7 @@ contains end subroutine get_server_from_url - function send_string(ssl, str, trimming) result(success) + function send_string(ssl, str, trimming, allow_trailing_null) result(success) use iso_c_binding use jessl implicit none @@ -226,12 +226,13 @@ contains logical::success type(c_ptr)::ssl character(*), intent(in)::str - logical, intent(in), optional::trimming + logical, intent(in), optional::trimming, allow_trailing_null integer::start_send integer::chars_sent_this_time, chars_sending integer::i integer::string_length + logical::end_with_null character, dimension(bufsize)::buffer @@ -245,6 +246,11 @@ contains string_length = len_trim(str) end if + end_with_null = .true. + if(present(allow_trailing_null)) then + end_with_null = allow_trailing_null + end if + success = .true. start_send = 1 do while(start_send <= string_length) @@ -259,7 +265,7 @@ contains end do ! A null character seems necessary at the end of the request - if(i >= string_length) then + if(i >= string_length .and. end_with_null) then chars_sending = chars_sending + 1 buffer(chars_sending) = c_null_char end if -- cgit v1.2.3