libcurl

How to decode an URI with UTF-8 characters in C++

爷,独闯天下 提交于 2019-12-11 22:38:50
问题 I need to decode an URI in C++. I found several questions about it, but they all fail to deal with UTF-8 encoding and accents (I'm interested in accurately dealing with ASCII characters). Then, I went with a broadly used library like libcurl... but it also failed to address the UTF-8 encoding. Here's what I'm doing string UriHelper::Decode(const string &encoded) { CURL *curl = curl_easy_init(); int outlength; char *cres = curl_easy_unescape(curl, encoded.c_str(), encoded.length(), &outlength)

libcurl imaps doesn't returns Header Field “Content-Transfer-Encoding” or “Content-Type”

懵懂的女人 提交于 2019-12-11 18:26:27
问题 I have been trying to detect encoding of an email manually, to see whether the email that i have just fetched needed to be base64 decoded or not, but that wasn't a complete solution. So now I'm trying to download the headers (fields) of an email first, check them what kind of email it is and then proceed to decoding it with base64 in case the header says that it is a base64 encoded email or just skip it if it is a plain text or HTML text. The problem is that the libcurl commands for fetching

PHP curl: curl_setopt() fopencookie failed

人盡茶涼 提交于 2019-12-11 18:08:56
问题 I'm trying to write a script, which would cache images, but am stuck with the following error message: Nov 4 12:55:19 centos httpd: PHP Fatal error: curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: fopencookie failed in /var/www/html/proxy3.php on line 6 I have prepared a simpler script which still has this problem: <?php #phpinfo(); $fh = fopen('/tmp/yahoo.html', 'xb'); if ($fh) { $ch = curl_init('http://www.yahoo.com/'); curl_setopt($ch, CURLOPT_FILE, $fh); # XXX the

what is the default path for curl_easy_setopt(curl, CURLOPT_CAINFO, “cacert.pem”);

匆匆过客 提交于 2019-12-11 17:58:48
问题 Where does this command look for the pem file ? It is not in the folder where the dll runs. When I use full path it works, when I use relative path - either like in the Title or ./cacert.pem) I get Error 77: CURLE_SSL_CACERT_BADFILE What is the right way to specify relative path for this file ? 回答1: Specifying a relative path there is asking for trouble. But it'd then use the relative path from whereever it is executed (no surprise there really). Possibly the SSL library your libcurl is built

RapidXML reading from file - what is wrong here?

北城余情 提交于 2019-12-11 17:13:40
问题 What's the difference between these two methods of reading an input file? 1) Using 'ifstream.get()' and 2) Using a vector<char> with ifstreambuf_iterator<char> (less understood by me!) (other than the obvious answer of having nifty vector methods to work with) The input file is XML, and as you see below, immediately parsed into a rapidxml document. (initialized elsewhere, see example main function.) First, let me show you two ways to write the 'load_config' function, one using ifstream.get()

How to disable Expect 100 continue in libcurl

感情迁移 提交于 2019-12-11 15:54:55
问题 I am using CURLOPT_POST to send an https message. During running, my application stuck at: Expect: 100-continue Done waiting for 100-continue 回答1: I just ran into this issue earlier today. i found the following page that also talks about it and suggests how to disable: George's Log -- When curl sends 100-continue In particular you can set an empty "Expect:" header in your put / post request. i found some sample code in the post-callback tutorial for curl that contains the following snippet

libcurl 编译

℡╲_俬逩灬. 提交于 2019-12-11 12:47:33
原文链接: https://blog.csdn.net/DaSo_CSDN/article/details/77587916 我是根据上诉文章在自己电脑上运行了一次,顺便再次整理一下,方便自己下次使用(感谢原作者) libcurl 下载地址: https://curl.haxx.se/download.html 1:安装VS2017 2:下载libcurl(本人使用的是:curl-7.59.0.zip) 编译步骤: 1:解压下载下来的libcurl安装包,并双击运行解压包中的“buildconf.bat”。 2:打开VS2017自带的命令提示符(强调不是win7系统的命令提示符) 选择对应的:编译64位就选64位的,编译32位就选32位的(编译几位的具体看自己工程所需要的运行环境) 比如此处本人选择64位的命令提示符。 3:通过命令提示符,进入libcul压缩包的winbuild文件夹 4:定制编译 输入“nmake /f Makefile.vc mode=static VC=15 MACHINE=x64 DEBUG=no”。 mode:static表示静态编译,dll表示动态编译 VC:VC后面的数字表示编译的libcurl和VS相对应的版本号,可在libcurl解压文件curl-7.59.0\projects\Windows查看所有的VC版本。 MACHINE

Persistent connection with libcurl

﹥>﹥吖頭↗ 提交于 2019-12-11 12:29:41
问题 The following is from the libcurl homepage: curl and libcurl have excellent support for persistent connections when transferring several files from the same server. Curl will attempt to reuse connections for all URLs specified on the same command line/config file, and libcurl will reuse connections for all transfers that are made using the same libcurl handle. Just to be sure, if I create a CURL handle (curl_easy_init()) and set it's headers, make a HTTP-request, then change the headers and

libcurl - POST after PUT issue

空扰寡人 提交于 2019-12-11 12:03:18
问题 I'm writing a http client in C using libcurl. However, I'm facing a weird issue when re-using the same handle for transfer a PUT followed by a POST . A sample code below: #include <curl/curl.h> void send_a_put(CURL *handle){ curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L); //PUT curl_easy_setopt(handle, CURLOPT_INFILESIZE, 0L); curl_easy_perform(handle); } void send_a_post(CURL *handle){ curl_easy_setopt(handle, CURLOPT_POST, 1L); //POST curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, 0L); curl

post request using curl

穿精又带淫゛_ 提交于 2019-12-11 11:45:57
问题 I'm about to build a small web service following the REST Architecture and I use the Slim Framework to handle Routing . I defined a post Route to be able to add a user for example in the database by sending the post request from another server using the curl Extension , the request is sent but I can't figure out a way to grab sent data to treat them in my callback function defined in the Routing . I let the code speak for itself : 1st , the route $app->post('/users/create/', function ($data)