+ curl_easy_setopt(m_handle,CURLOPT_FILE,&m_stream);
+ curl_easy_setopt(m_handle,CURLOPT_POST,1);
+ if (m_chunked) {
+ m_headers=curl_slist_append(m_headers,"Transfer-Encoding: chunked");
+ curl_easy_setopt(m_handle,CURLOPT_READFUNCTION,&curl_read_hook);
+ curl_easy_setopt(m_handle,CURLOPT_READDATA,&in);
+ }
+ else {
+ char buf[1024];
+ while (in) {
+ in.read(buf,1024);
+ msg.append(buf,in.gcount());
+ }
+ curl_easy_setopt(m_handle,CURLOPT_READFUNCTION,NULL);
+ curl_easy_setopt(m_handle,CURLOPT_POSTFIELDS,msg.c_str());
+ curl_easy_setopt(m_handle,CURLOPT_POSTFIELDSIZE,msg.length());
+ }