让 cocos2d-x 的 CCHttpRequest 支持https(3)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:12 点击:次
p> /* handle custom header data */
p> /* create curl linked list */
p> struct curl_slist *cHeaders=NULL;
p> /* get custom header data (if set) */
p> std::vector<std::string> headers=request->getHeaders();
p> if(!headers.empty())
p> {
p> for(std::vector<std::string>::iterator it=headers.begin();it!=headers.end();it++)
p> {
p> /* append custom headers one by one */
p> cHeaders=curl_slist_append(cHeaders,it->c_str());
p> }
p> /* set custom headers for curl */
p> code = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, cHeaders);
p> if (code != CURLE_OK) {
p> break;
p> }
p> }
p>
p> code = curl_easy_setopt(curl, CURLOPT_URL, request->getUrl());
p> if (code != CURLE_OK) {
p> break;
p> }
p> code = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, callback);
p> if (code != CURLE_OK) {
p> break;
p> }
p> code = curl_easy_setopt(curl, CURLOPT_WRITEDATA, stream);
p> if (code != CURLE_OK) {
p> break;
p> }
p> code = curl_easy_setopt(curl, CURLOPT_POST, 1);
p> if (code != CURLE_OK) {
p> break;
p> }
p> code = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
p> if (code != CURLE_OK) {
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>