Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: POST Request with non-null-terminated string
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Milen Nikolov via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 26 Apr 2021 18:44:48 +0200 (CEST)
Hi,
thanks for the answer, I got a few more suggesting the same option. I tried it today and it worked fine. I have a follow up question though. In the string I'm sending there are extended ASCII characters. I'm currently sending them to a test server and what I'm getting back is incorrect. However since I haven't set up the server it's hard for me to know if the problem is with curl or with the way the server is set up, so I wanted to know if the extended ASCII chars in the POST field are getting sent correctly. I tried searching but I only found suggestions to URL encode them, which in my case is impossible, since the server is supposed to read the HEX value of the symbol using the Latin 1 encoding.
Best Regards,
Milen
> On 23/04/2021 17:17 Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>
> On Fri, 23 Apr 2021, Milen Nikolov via curl-library wrote:
>
> > I'm using libcurl in C++ and I have to make a post request to a server,
> > containing a string in the body section. Another -condition is that I have
> > to specify the content-type as octet-stream. I've set the header,
> > authentication and so on, but there is one problem: the curl function
> > (CURLOPT_POSTFIELDS) takes as argument a c-string. In my string there are
> > also NUL characters, which have to be sent. When I try sending the request
> > the body is truncated at the first NUL chararcter.
>
> Set CURLOPT_POSTFIELDSIZE to the size of the data and it will not do strlen()
> to figure out the size.
>
> I also just filed https://github.com/curl/curl/pull/6943 to clarify this
> better.
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-04-26
Date: Mon, 26 Apr 2021 18:44:48 +0200 (CEST)
Hi,
thanks for the answer, I got a few more suggesting the same option. I tried it today and it worked fine. I have a follow up question though. In the string I'm sending there are extended ASCII characters. I'm currently sending them to a test server and what I'm getting back is incorrect. However since I haven't set up the server it's hard for me to know if the problem is with curl or with the way the server is set up, so I wanted to know if the extended ASCII chars in the POST field are getting sent correctly. I tried searching but I only found suggestions to URL encode them, which in my case is impossible, since the server is supposed to read the HEX value of the symbol using the Latin 1 encoding.
Best Regards,
Milen
> On 23/04/2021 17:17 Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>
> On Fri, 23 Apr 2021, Milen Nikolov via curl-library wrote:
>
> > I'm using libcurl in C++ and I have to make a post request to a server,
> > containing a string in the body section. Another -condition is that I have
> > to specify the content-type as octet-stream. I've set the header,
> > authentication and so on, but there is one problem: the curl function
> > (CURLOPT_POSTFIELDS) takes as argument a c-string. In my string there are
> > also NUL characters, which have to be sent. When I try sending the request
> > the body is truncated at the first NUL chararcter.
>
> Set CURLOPT_POSTFIELDSIZE to the size of the data and it will not do strlen()
> to figure out the size.
>
> I also just filed https://github.com/curl/curl/pull/6943 to clarify this
> better.
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-04-26