Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Failed to POST binary data #180

Closed
rayman-zhao opened this issue Jul 26, 2024 · 1 comment
Closed

Failed to POST binary data #180

rayman-zhao opened this issue Jul 26, 2024 · 1 comment

Comments

@rayman-zhao
Copy link

rayman-zhao commented Jul 26, 2024

Hi, when try to do a post request with binary data as:

http(('POST', url, headers, 'application/octet-stream', http.bytea_to_text(data))::http.http_request);

It's failed to upload whole data , only few bytes received on server.

In the http.c file line 1203 shows:

CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, text_to_cstring(content_text));

This is only allow C-style null terminated data.

CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, (char *)(VARDATA(content_text)));
CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDSIZE, content_size);

The above 2 lines can fix this issue.

@bog1978
Copy link

bog1978 commented Sep 16, 2024

Thanks, your patch helped me.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants