libcurl

libcurl callbacks w/c++ class members

橙三吉。 提交于 2019-12-09 03:45:04
问题 Taken from the libcurl programming tutorial on the libcurl site: libcurl with C++ There's basically only one thing to keep in mind when using C++ instead of C when interfacing libcurl: The callbacks CANNOT be non-static class member functions Example C++ code: class AClass { static size_t write_data(void *ptr, size_t size, size_t nmemb, void ourpointer) { /* do what you want with the data */ } } What is this limitation for, is it a problem of scope? If each class member has it's own easy

libcurl — Keep Connection “open” to Upload Multiple Files (FTP)

自古美人都是妖i 提交于 2019-12-09 02:40:09
问题 I need to upload directories to a FTP server on my application, and plan to use libcurl . I see there is no direct way to upload a directory with many files, which makes sense to me. I couldn't, however, find any mention on uploading many files. If I get the list of files in the directory, I could upload them in a loop. The option CURLOPT_FTP_CREATE_MISSING_DIRS might help with sub-directories, but if I'd like to know also if I'm missing the point here or this would have any serious drawback.

Server Name Indication from C#

佐手、 提交于 2019-12-08 18:01:08
问题 As far as I can tell, there seems to be a big limitation in .NET in that there is no way using C# and .NET to make an TLS connection that uses Server Name Indication (SNI). Have I missed something or is my understanding correct? Does anybody know if and how I could make an SNI connection using OpenSSL.NET, libcurl.NET or some other 3rd party .NET library? Some sample code would be very much appreciated. 回答1: In my .Net 4.5 project the following fails for a server using SNI: var url = "https:/

Posting an array with curl_setopt

倾然丶 夕夏残阳落幕 提交于 2019-12-08 14:40:05
问题 The attached code is returning "Notice: Array to string conversion in...". Simply my array is being handled to the remote server as a string containing "Array" word. the rest of the variables are fine. How can I pass my array $anarray without this problem? <?php $data = array( 'anarray' => $anarray, 'var1' => $var1, 'var2' => $var2 ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "MY_URL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); ?>

How do I use libcurl to printf a remote FTP directory listing?

半城伤御伤魂 提交于 2019-12-08 13:12:28
I think I'm supposed to use CURLOPT_DIRLISTONLY but I'm not really sure how to proceed. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long listonly); I'm not sure how to make the call to actually print the list. Enabling the CURLOPT_DIRLISTONLY option for FTP has the effect of retrieving only file names instead of file details (e.g. file size, date, etc.) basically as the difference between using a plain ls (only names) or a ls -l (listing with details) on UNIX. At the FTP protocol level, enabling CURLOPT_DIRLISTONLY will make libcurl issue a NLST command rather than a LIST .

LibCurl - Release Static Lib linking problems

隐身守侯 提交于 2019-12-08 09:31:21
问题 I have been at this for some time now. I hope someone can tell me what I am doing wrong. These are the steps I have taken so far: -Downloaded the latest version of cURL (7.21.7). -Opened the solution in Visual Studio 2010 using the vc6curl.dsw and converted the projects to VS2010. -Set the libcurl project configuration to "release" and built. Build succeeded.A folder called "LIB-Release" is created. It contains several obj files and the "libcurl.lib" file resides here as well. Test

Synchronized curl requests

柔情痞子 提交于 2019-12-08 09:29:22
问题 I'm trying to do HTTP requests to multiple targets, and I need to them to run (almost) exactly at the same moment. I'm trying to create a thread for each request, but I don't know why Curl is crashing when doing the perform. I'm using an easy-handle per thread so in theory everything should be ok... Has anybody had a similar problem? or Does anyone know if the multi interface allows you to choose when to perform all the requests? Thanks a lot. EDIT: Here is an example of the code: void Clazz:

How do I use libcurl to printf a remote FTP directory listing?

爱⌒轻易说出口 提交于 2019-12-08 06:24:28
问题 I think I'm supposed to use CURLOPT_DIRLISTONLY but I'm not really sure how to proceed. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long listonly); I'm not sure how to make the call to actually print the list. 回答1: Enabling the CURLOPT_DIRLISTONLY option for FTP has the effect of retrieving only file names instead of file details (e.g. file size, date, etc.) basically as the difference between using a plain ls (only names) or a ls -l (listing with details) on UNIX. At the FTP

Error: InvalidAction on DescribeRegions API call (Amazon AWS/EC2 API)

╄→尐↘猪︶ㄣ 提交于 2019-12-08 06:09:22
问题 I'm writing an app to interact with the Amazon EC2 API and since I've never done this before, I decided to start with something easy like DescribeRegions. I'm doing this in C so there are no easy to use libraries out there for this so I'm having to hack it together with libcurl and libcrypto. Full disclosure, this is the first time I'm interacting with AWS/EC2 API programmatically so this may well be a stupid newbie mistake. I did read through stackoverflow; this is not the same as the

CURL Post method in c++

有些话、适合烂在心里 提交于 2019-12-08 05:01:05
问题 Suppose we have a HTTP request like following: POST /safebrowsing/downloads?client=Firefox&appver=3.0.8&pver=2.2&wrkey=AKEgNiux-3bBzAgJeFWgqbneh_GLc2OrmgXnpxPrdH1-hFpbAM8k1ovPA8GB_UMRueBHnL3QJ7gsdQOWVm6QJr_VZNgAm8jmLQ== HTTP/1.1 Host: safebrowsing.clients.google.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033100 Ubuntu/9.04 (jaunty) Firefox/3.0.8 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept