From 0e080ce3e114894dac5ee4aca8ec90ed376ecbdc Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Thu, 14 Oct 2010 15:48:23 +0200 Subject: [PATCH] Fix another user-agent pointer bug. Fix user-agent string --- src/ip_addr_helper.cpp | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ip_addr_helper.cpp b/src/ip_addr_helper.cpp index 429356a..49c4b9a 100644 --- a/src/ip_addr_helper.cpp +++ b/src/ip_addr_helper.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "version_info.h" using namespace std; @@ -556,7 +557,9 @@ CURLcode IPAddrHelper::set_curl_url(CURL * curl_easy_handle, const string& url) */ CURL * IPAddrHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) const { - string user_agent = "Intra2net AG - Bullet Proof DYNDNS Daemon - 0.1.1"; + ostringstream user_agent_stream; + user_agent_stream << "Intra2net AG - Bullet Proof DYNDNS Daemon - " << MAJOR_VERSION << "." << MINOR_VERSION << endl; + string user_agent = user_agent_stream.str(); CURL *curl_easy_handle = curl_easy_init(); if ( curl_easy_handle == NULL ) @@ -580,7 +583,7 @@ CURL * IPAddrHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) if ( curlError == CURLE_OK) curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_WRITEDATA,&curl_writedata_buff); if ( curlError == CURLE_OK) - curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_USERAGENT,&user_agent); + curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_USERAGENT,user_agent.c_str()); if ( !Proxy.empty() ) { -- 1.7.1