+static size_t headerCallback (char* ptr, size_t size, size_t nmemb, void* data)
+{
+ size_t realsize = size * nmemb;
+ struct HttpGet::HeaderInfo *nfo = (struct HttpGet::HeaderInfo*)data;
+ std::string header (static_cast<const char*>(ptr), realsize);
+ std::string::size_type index = header.find (':', 0);
+ if (index != std::string::npos) {
+ std::string k = header.substr (0, index);
+ std::string v = header.substr (index + 2);
+ k.erase(k.find_last_not_of (" \n\r\t")+1);
+ v.erase(v.find_last_not_of (" \n\r\t")+1);
+ nfo->h[k] = v;
+ }
+
+ return realsize;
+}