cURL / Mailing Lists / curl-library / Single Mail


curlopts_writedata not being passed to writefunction properly.

From: Joshua Kordani <>
Date: Mon, 13 Jan 2014 11:21:41 -0500

This was originally posted to the curl-users group, and I was encouraged
to post here instead.

annotation 1 is a single code file listing that should compile, (you
just need to link curl)
annotation 2 is the output I get of running that code on a test rtsp url

I am running on osx 10.7.5 with the latest curl from macports.

I am attempting to use writedata and writefunc to parse a response
header from the server and hand it back out to my application. I've
been attempting to debug this for a few days. It seems to me that the
pointer that gets given to the curl library doesn't make its way to the
writefunction. I print out the value of the pointer before I pass it to
curl, and in my test function I print out the value of the userdata
pointer, and they don't agree.

In an effort to clarify, I declare a pointer to a struct, initialize it
with new, and pass it to the curl_writedata function. Some of my
printfs aren't updated to reflect that, earlier in troubleshooting I'd
declared a local struct and passed its address instead. I encountered
the same problem.

I have 2 helper macros in there to catch any error as a result of failed
calls to curl_easy* functions. I have a test struct I use to pass data
in and out of the writefunc, but the writefunc is just a stub for now,
outlining what I'm trying to do to access userdata.

Thanks for any assistance with this.

Joshua Kordani
LSA Autonomy

List admin:
Received on 2014-01-13