Skip to content

Commit 5234861

Browse files
use len(data) instead of data_length
1 parent 108c2f4 commit 5234861

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/http/http_client.f90

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ function new_request(url, method, header, data) result(response)
6262
request%header = [header_type('user-agent', 'fortran-http/0.1.0')]
6363
end if
6464

65+
! setting the request data to be send
6566
if(present(data)) then
6667
request%data = data
6768
end if
@@ -189,12 +190,9 @@ end function set_method
189190
function set_body(curl_ptr, data) result(status)
190191
type(c_ptr), intent(out) :: curl_ptr
191192
character(*), intent(in) :: data
192-
integer :: status, data_length
193-
data_length = len(data)
194-
! if(json_length > 0) then
195-
status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDS, data)
196-
status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDSIZE_LARGE, data_length)
197-
! end if
193+
integer :: status
194+
status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDS, data)
195+
status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDSIZE_LARGE, len(data))
198196
end function set_body
199197

200198
function client_response_callback(ptr, size, nmemb, client_data) bind(c)

0 commit comments

Comments
 (0)