libmoost
|
00001 /* vim:set ts=3 sw=3 sts=3 et: */ 00036 #ifndef FM_LAST_MOOST_MURCL_USER_AGENT_HPP__ 00037 #define FM_LAST_MOOST_MURCL_USER_AGENT_HPP__ 00038 00039 #include <string> 00040 #include <sstream> 00041 00042 #include <curl/curl.h> 00043 00044 namespace moost { namespace murcl { 00045 00052 struct user_agent 00053 { 00060 static std::string get() 00061 { 00062 // according to the docs for LibCurl, this does not need to be free'd. 00063 // http://curl.haxx.se/libcurl/c/curl_version_info.html 00064 curl_version_info_data * ver = curl_version_info(CURLVERSION_NOW); 00065 00066 std::ostringstream oss; 00067 00068 oss 00069 << "curl/" 00070 << ver->version 00071 << '(' << ver->host << ')' 00072 << " libcurl " << ver->version 00073 << '(' << ver->ssl_version << ')'; 00074 00075 if((ver->features & CURL_VERSION_IPV6) == CURL_VERSION_IPV6) 00076 { 00077 oss 00078 << " (ipv6 enabled)"; 00079 } 00080 00081 return oss.str(); 00082 } 00083 }; 00084 00085 }} 00086 00087 #endif // FM_LAST_MOOST_MURCL_USER_AGENT_HPP__