curl-library
RE: CURL custom POST commands
Date: Sat, 29 Aug 2015 00:40:17 +0200 (CEST)
On Fri, 28 Aug 2015, Fitzgerald, Kevin wrote:
> Hello again. It appears that I am now successfully connecting to the web
> service, but I having one issue that I don’t understand.
Why oh why are you using curl_easy_recv() if you speak plain HTTP ? It is just
asking for problems and writing more code than you have to.
> res = curl_easy_recv(curl, s2, 32768, &iolen);
>
> if(CURLE_OK != res)
> break;
>
> fprintf(stdout, "%s\n", s2);
> nread = (curl_off_t)iolen;
>
> s2 is a buffer to capture the response. I am displaying this buffer in my
> job’s sysout. The issue is that it appears that all of the data in the
> response is not in the buffer.
That's how reading from a socket often works and how curl_easy_recv() does. It
gives you all the data that's there now. If more arrives later, you need to
call it again.
I'll reiterate for emphasis: don't go there. Don't use curl_easy_recv() unless
you have a really good reason and doing simple HTTP is not one of those good
reasons.
-- / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-08-29