Put request with postfields libcurl c++
2009-11-02 07:26:56 GMT
I am somewhat new to libcurl and I was recently faced with a problem that I hope someone can have the answer to it. My problem is that I’m supposed to send a PUT request to a website and that request should also include an XML as raw data. The problem is I can’t seem to be able to configure my read callback to read from a string if that is actually how its done. Basically I’m trying to send this request to Amazon S3 to enable their new versioning feature, and as described by Amazon, I am supposed to do something like this:
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE=
Now the first part of the request is straight forward and I don’t really have any problem with it; the xml data part however is giving me nightmares as I have tried almost everything to make it work, I even tried adding it manually via the HTTPHEADER and it did not work.
And as I mentioned above, I tried reading the data directly from a string although I don’t think it’s the right approach but still here is my READFUNCTION:
size_t readTextCallback(void* ptr,size_t size, size_t nmemb, void* stream)
cout << "read_data being called" << endl;
string* strptrdst = static_cast<string*>(ptr);
strptrdst = static_cast<string*>(stream);
Now for some reason, when I use a read function Curl keeps calling the function until the request gets terminated by the remote host.
Can someone please help..
C++ Software Developer
Email: z.alamir <at> genie-soft.com
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html