当前位置: 首页>>代码示例>>C++>>正文


C++ curl_version函数代码示例

本文整理汇总了C++中curl_version函数的典型用法代码示例。如果您正苦于以下问题:C++ curl_version函数的具体用法?C++ curl_version怎么用?C++ curl_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了curl_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tool_version_info

void tool_version_info(void)
{
  const char *const *proto;

  printf(CURL_ID "%s\n", curl_version());
#ifdef CURL_PATCHSTAMP
  printf("Release-Date: %s, security patched: %s\n",
         LIBCURL_TIMESTAMP, CURL_PATCHSTAMP);
#else
  printf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
#endif
  if(curlinfo->protocols) {
    printf("Protocols: ");
    for(proto = curlinfo->protocols; *proto; ++proto) {
      printf("%s ", *proto);
    }
    puts(""); /* newline */
  }
  if(curlinfo->features) {
    unsigned int i;
    printf("Features: ");
    for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) {
      if(curlinfo->features & feats[i].bitmask)
        printf("%s ", feats[i].name);
    }
#ifdef USE_METALINK
    printf("Metalink ");
#endif
#ifdef USE_LIBPSL
    printf("PSL ");
#endif
    puts(""); /* newline */
  }
}
开发者ID:Andersbakken,项目名称:curl,代码行数:34,代码来源:tool_help.c

示例2: debug_curl_version

char* debug_curl_version(void)
{
  char* ret;
  ret = curl_version();
  Dout(dc::curl, "curl_version() = \"" << ret << '"');
  return ret;
}
开发者ID:Nekrofage,项目名称:SingularityViewer,代码行数:7,代码来源:debug_libcurl.cpp

示例3: show_version

void
show_version(void)
{
	struct utsname u;
	const char *fmt = " %s: %s\n";

	fprintf(stderr, "%s %s\n", __progname, vertag);

	fprintf(stderr, "Run-time versions:\n");
	fprintf(stderr, fmt, "assl", assl_verstring());
#ifdef NEED_LIBCLENS
	fprintf(stderr, fmt, "clens", clens_verstring());
#endif /* NEED_LIBCLENS */
	fprintf(stderr, fmt, "clog", clog_verstring());
	fprintf(stderr, fmt, "curl", curl_version());
	fprintf(stderr, fmt, "event", event_get_version());
	fprintf(stderr, fmt, "exude", exude_verstring());
	fprintf(stderr, fmt, "openssl", SSLeay_version(SSLEAY_VERSION));
	fprintf(stderr, fmt, "shrink", shrink_verstring());
	fprintf(stderr, fmt, "xmlsd", xmlsd_verstring());

	fprintf(stderr, "O/S identification: ");
	if (uname(&u) == -1)
		fprintf(stderr, "INVALID\n");
	else
		fprintf(stderr, "%s-%s-%s %s\n", u.sysname, u.machine, u.release, u.version);
}
开发者ID:finid,项目名称:cyphertite,代码行数:27,代码来源:ct_main.c

示例4: _ch

vz::Api::Api(Channel::Ptr ch)
		: _ch(ch)
						//    , _api(api)
{
	char url[255], agent[255];

/* prepare header, uuid & url */
	sprintf(agent, "User-Agent: %s/%s (%s)", PACKAGE, VERSION, curl_version());     /* build user agent */
	sprintf(url, "%s/data/%s.json", _ch->middleware(), _ch->uuid());                        /* build url */

	_api.headers = NULL;
	_api.headers = curl_slist_append(_api.headers, "Content-type: application/json");
	_api.headers = curl_slist_append(_api.headers, "Accept: application/json");
	_api.headers = curl_slist_append(_api.headers, agent);

	// WORKAROUND for lighthttp not supporting Expect: properly
	_api.headers = curl_slist_append(_api.headers, "Expect: ");

	_api.curl = curl_easy_init();
	if (!_api.curl) {
		throw vz::VZException("CURL: cannot create handle.");
	}

	curl_easy_setopt(_api.curl, CURLOPT_URL, url);
	curl_easy_setopt(_api.curl, CURLOPT_HTTPHEADER, _api.headers);
	curl_easy_setopt(_api.curl, CURLOPT_VERBOSE, options.verbosity());
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGFUNCTION, curl_custom_debug_callback);
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGDATA, _ch.get());

}
开发者ID:mbehr1,项目名称:vzlogger,代码行数:30,代码来源:api.cpp

示例5: curl_global_init

void HttpClient::initCURL()
{
    // init global
    static bool globalInitialized = false;
    if (!globalInitialized)
    {
        curl_global_init(CURL_GLOBAL_ALL); // there won't be curl_global_cleanup();
        globalInitialized = true;
    }
    
    // init current session
    m_curl = curl_easy_init();
    
    //    curl_easy_setopt(m_curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);	// support basic, digest, and NTLM authentication
    // try not to use signals
    curl_easy_setopt(m_curl, CURLOPT_NOSIGNAL, 1L);
    
    // set a default user agent
    curl_easy_setopt(m_curl, CURLOPT_USERAGENT, curl_version());
    
#ifdef DEBUG_MODE
    // Switch on full protocol/debug output while testing
    curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1L);
    
    // disable progress meter, set to 0L to enable and disable debug output
    curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1L);
#endif
}
开发者ID:jvaemape,项目名称:Downloader,代码行数:28,代码来源:HttpClient.cpp

示例6: tool_version_info

void tool_version_info(void)
{
  const char *const *proto;

  printf(CURL_ID "%s\n", curl_version());
  if(curlinfo->protocols) {
    printf("Protocols: ");
    for(proto = curlinfo->protocols; *proto; ++proto) {
      printf("%s ", *proto);
    }
    puts(""); /* newline */
  }
  if(curlinfo->features) {
    unsigned int i;
    printf("Features: ");
    for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) {
      if(curlinfo->features & feats[i].bitmask)
        printf("%s ", feats[i].name);
    }
#ifdef USE_METALINK
    printf("Metalink ");
#endif
    puts(""); /* newline */
  }
}
开发者ID:FPSzeYad,项目名称:curl,代码行数:25,代码来源:tool_help.c

示例7: VSICurlSetOptions

void VSICurlStreamingHandle::DownloadInThread()
{
    VSICurlSetOptions(hCurlHandle, pszURL);

    static int bHasCheckVersion = FALSE;
    static int bSupportGZip = FALSE;
    if (!bHasCheckVersion)
    {
        bSupportGZip = strstr(curl_version(), "zlib/") != NULL;
        bHasCheckVersion = TRUE;
    }
    if (bSupportGZip && CSLTestBoolean(CPLGetConfigOption("CPL_CURL_GZIP", "YES")))
    {
        curl_easy_setopt(hCurlHandle, CURLOPT_ENCODING, "gzip");
    }

    if (pabyHeaderData == NULL)
        pabyHeaderData = (GByte*) CPLMalloc(HEADER_SIZE + 1);
    nHeaderSize = 0;
    nBodySize = 0;
    nHTTPCode = 0;

    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, this);
    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, VSICurlStreamingHandleReceivedBytesHeader);

    curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, this);
    curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, VSICurlStreamingHandleReceivedBytes);

    char szCurlErrBuf[CURL_ERROR_SIZE+1];
    szCurlErrBuf[0] = '\0';
    curl_easy_setopt(hCurlHandle, CURLOPT_ERRORBUFFER, szCurlErrBuf );

    CURLcode eRet = curl_easy_perform(hCurlHandle);

    curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, NULL);
    curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, NULL);
    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, NULL);
    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, NULL);

    AcquireMutex();
    if (!bAskDownloadEnd && eRet == 0 && !bHastComputedFileSize)
    {
        poFS->AcquireMutex();
        CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
        cachedFileProp->fileSize = fileSize = nBodySize;
        cachedFileProp->bHastComputedFileSize = bHastComputedFileSize = TRUE;
        if (ENABLE_DEBUG)
            CPLDebug("VSICURL", "File size = " CPL_FRMT_GUIB, fileSize);
        poFS->ReleaseMutex();
    }

    bDownloadInProgress = FALSE;
    bDownloadStopped = TRUE;

    /* Signal to the consumer that the download has ended */
    CPLCondSignal(hCondProducer);
    ReleaseMutex();
}
开发者ID:0004c,项目名称:node-gdal,代码行数:58,代码来源:cpl_vsil_curl_streaming.cpp

示例8: set_info

/*
 * Assumes the table is on top of the stack.
 */
static void set_info (lua_State *L) 
{
	LUA_SET_TABLE(L, literal, "_COPYRIGHT", literal, "(C) 2003-2006 AVIQ Systems AG");
	LUA_SET_TABLE(L, literal, "_DESCRIPTION", literal, "LuaCurl binds the CURL easy interface to Lua");
	LUA_SET_TABLE(L, literal, "_NAME", literal, "luacurl");
	LUA_SET_TABLE(L, literal, "_VERSION", literal, "1.1.0");
	LUA_SET_TABLE(L, literal, "_CURLVERSION", string, curl_version());
	LUA_SET_TABLE(L, literal, "_SUPPORTED_CURLVERSION", literal, LIBCURL_VERSION);
}
开发者ID:catyguan,项目名称:gamedev.platform,代码行数:12,代码来源:luacurl.c

示例9: snprintf

/*
 * my_useragent: returns allocated string with default user agent
 */
char *my_useragent(void)
{
  char useragent[256]; /* we don't want a larger default user agent */

  snprintf(useragent, sizeof(useragent),
           CURL_NAME "/" CURL_VERSION " (" OS ") " "%s", curl_version());

  return strdup(useragent);
}
开发者ID:matthewstory,项目名称:curl,代码行数:12,代码来源:tool_operhlp.c

示例10: sprintf

void *do_subscribe_stuff(void *postfields)
{
  char *response, url[] = "http://127.0.0.1/kn";
  CURL *curl_handle;
  CURLcode res;
  long int status = 0;
/*  char name[12];
  FILE *file;

  sprintf(name,"dumpit%d.txt", pthread_self());
  file = fopen(name, "w");*/
  /* init the curl session */
  curl_handle = curl_easy_init();

  printf ("SUB %s\n", curl_version());

  if(curl_handle) {

    /* specify URL to get */
    curl_easy_setopt(curl_handle, CURLOPT_URL, subdata[0]);
/*    curl_easy_setopt(curl_handle, CURLOPT_FILE, file);*/
    curl_easy_setopt(curl_handle, CURLOPT_HEADER, 0);
    curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
/*    curl_easy_setopt(curl_handle, CURLOPT_POST, 1);*/
/*    curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, subdata[0]);*/
    curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "PubSub Throughput 1.0");
#ifdef DEBUG
    curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
#else
    curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1);
    curl_easy_setopt(curl_handle, CURLOPT_MUTE, 1);
#endif

/*   while (1) {*/
    printf("\n sub thread %d\n", pthread_self());

    /* get it! */
    res = curl_easy_perform(curl_handle);
    if(res==0) {
      /*
       * Now, our chunk.memory points to a memory block that is chunk.size
       * bytes big and contains the remote file.
       */
      curl_easy_getinfo(curl_handle, CURLINFO_HTTP_CODE, &status);
    }
    curl_easy_setopt(curl_handle, CURLOPT_URL, subdata[1]);

    printf("\n sub thread change url\n");

    res = curl_easy_perform(curl_handle);
/*   }*/
  }
  curl_easy_cleanup(curl_handle);
/*  fclose(file);*/
  return 0;
}
开发者ID:kragen,项目名称:mod_pubsub,代码行数:56,代码来源:throughput.c

示例11: HTTP_Init

/*
===============
HTTP_Init

Init libcurl.
===============
*/
void HTTP_Init (void)
{
	curl_global_init (CURL_GLOBAL_NOTHING);
	multi = curl_multi_init ();

	Com_sprintf (hostHeader, sizeof(hostHeader), "Host: %s", g_http_domain->string);
	http_header_slist = curl_slist_append (http_header_slist, hostHeader);

	gi.dprintf ("%s initialized.\n", curl_version());
}
开发者ID:notr1ch,项目名称:opentdm,代码行数:17,代码来源:g_tdm_curl.c

示例12: libcurl_mod_init

int libcurl_mod_init(const struct ammodule_t* module, int flags)
{
    CLOGI("libcurl module init\n");
    char * ver = NULL;
    ver = curl_version();
    CLOGI("curl version : [%s]", ver);
    curl_global_init(CURL_GLOBAL_ALL);
    av_register_protocol(&ff_curl_protocol);
    return 0;
}
开发者ID:CoreTech-Development,项目名称:amlogic-libplayer,代码行数:10,代码来源:curl_mod.c

示例13: CUserReporterWorker

	CUserReporterWorker(const std::string& userID, const std::string& url) :
		m_URL(url), m_UserID(userID), m_Enabled(false), m_Shutdown(false), m_Status("disabled"),
		m_PauseUntilTime(timer_Time()), m_LastUpdateTime(timer_Time())
	{
		// Set up libcurl:

		m_Curl = curl_easy_init();
		ENSURE(m_Curl);

#if DEBUG_UPLOADS
		curl_easy_setopt(m_Curl, CURLOPT_VERBOSE, 1L);
#endif

		// Capture error messages
		curl_easy_setopt(m_Curl, CURLOPT_ERRORBUFFER, m_ErrorBuffer);

		// Disable signal handlers (required for multithreaded applications)
		curl_easy_setopt(m_Curl, CURLOPT_NOSIGNAL, 1L);

		// To minimise security risks, don't support redirects
		curl_easy_setopt(m_Curl, CURLOPT_FOLLOWLOCATION, 0L);

		// Set IO callbacks
		curl_easy_setopt(m_Curl, CURLOPT_WRITEFUNCTION, ReceiveCallback);
		curl_easy_setopt(m_Curl, CURLOPT_WRITEDATA, this);
		curl_easy_setopt(m_Curl, CURLOPT_READFUNCTION, SendCallback);
		curl_easy_setopt(m_Curl, CURLOPT_READDATA, this);

		// Set URL to POST to
		curl_easy_setopt(m_Curl, CURLOPT_URL, url.c_str());
		curl_easy_setopt(m_Curl, CURLOPT_POST, 1L);

		// Set up HTTP headers
		m_Headers = NULL;
		// Set the UA string
		std::string ua = "User-Agent: 0ad ";
		ua += curl_version();
		ua += " (http://play0ad.com/)";
		m_Headers = curl_slist_append(m_Headers, ua.c_str());
		// Override the default application/x-www-form-urlencoded type since we're not using that type
		m_Headers = curl_slist_append(m_Headers, "Content-Type: application/octet-stream");
		// Disable the Accept header because it's a waste of a dozen bytes
		m_Headers = curl_slist_append(m_Headers, "Accept: ");
		curl_easy_setopt(m_Curl, CURLOPT_HTTPHEADER, m_Headers);


		// Set up the worker thread:

		// Use SDL semaphores since OS X doesn't implement sem_init
		m_WorkerSem = SDL_CreateSemaphore(0);
		ENSURE(m_WorkerSem);

		int ret = pthread_create(&m_WorkerThread, NULL, &RunThread, this);
		ENSURE(ret == 0);
	}
开发者ID:2asoft,项目名称:0ad,代码行数:55,代码来源:UserReport.cpp

示例14: ApiIF

vz::api::Volkszaehler::Volkszaehler(
	Channel::Ptr ch,
	std::list<Option> pOptions
	)
	: ApiIF(ch)
	, _last_timestamp(0)
{
	OptionList optlist;
	char url[255], agent[255];
	unsigned short curlTimeout = 30; // 30 seconds

/* parse options */
	try {
		_middleware = optlist.lookup_string(pOptions, "middleware");
	} catch (vz::OptionNotFoundException &e) {
		throw;
	} catch (vz::VZException &e) {
		throw;
	}

	try {
		curlTimeout = optlist.lookup_int(pOptions, "timeout");
	} catch (vz::OptionNotFoundException &e) {
	// use default value instead
		curlTimeout = 30; // 30 seconds
	} catch (vz::VZException &e) {
		throw;
	}

/* prepare header, uuid & url */
	sprintf(agent, "User-Agent: %s/%s (%s)", PACKAGE, VERSION, curl_version());     /* build user agent */
	sprintf(url, "%s/data/%s.json", middleware().c_str(), channel()->uuid());                        /* build url */

	_api.headers = NULL;
	_api.headers = curl_slist_append(_api.headers, "Content-type: application/json");
	_api.headers = curl_slist_append(_api.headers, "Accept: application/json");
	_api.headers = curl_slist_append(_api.headers, agent);

	_api.curl = curl_easy_init();
	if (!_api.curl) {
		throw vz::VZException("CURL: cannot create handle.");
	}

	curl_easy_setopt(_api.curl, CURLOPT_URL, url);
	curl_easy_setopt(_api.curl, CURLOPT_HTTPHEADER, _api.headers);
	curl_easy_setopt(_api.curl, CURLOPT_VERBOSE, options.verbosity());
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGFUNCTION, curl_custom_debug_callback);
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGDATA, channel().get());

	// signal-handling in libcurl is NOT thread-safe. so force to deactivated them!
	curl_easy_setopt(_api.curl, CURLOPT_NOSIGNAL, 1);

	// set timeout to 5 sec. required if next router has an ip-change.
	curl_easy_setopt(_api.curl, CURLOPT_TIMEOUT, curlTimeout);
}
开发者ID:DoganA,项目名称:vzlogger,代码行数:55,代码来源:Volkszaehler.cpp

示例15: HTTP_Init

/*
===============
HTTP_Init

Init libcurl and multi handle.
===============
*/
void HTTP_Init (void) {
    cl_http_downloads = Cvar_Get ("cl_http_downloads", "1", 0);
    cl_http_filelists = Cvar_Get ("cl_http_filelists", "1", 0);
    cl_http_max_connections = Cvar_Get ("cl_http_max_connections", "2", 0);
    //cl_http_max_connections->changed = _cl_http_max_connections_changed;
    cl_http_proxy = Cvar_Get ("cl_http_proxy", "", 0);
#ifdef _DEBUG
    cl_http_debug = Cvar_Get ("cl_http_debug", "0", 0);
#endif

    curl_global_init (CURL_GLOBAL_NOTHING);
    curl_initialized = qtrue;
    Com_DPrintf ("%s initialized.\n", curl_version());
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:21,代码来源:cl_http.c


注:本文中的curl_version函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。