bool CFileCurl::GetMimeType(const CURL &url, CStdString &content, CStdString useragent) { /* 歌方: 1、 卦指: 1、 傍苧: 1、 */ CFileCurl file; if (!useragent.IsEmpty()) file.SetUserAgent(useragent); if( file.Stat(url, NULL) == 0 ) { content = file.GetMimeType(); CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> %s", url.Get().c_str(), content.c_str()); return true; } CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> failed", url.Get().c_str()); content = ""; return false; }
bool CFileCurl::GetMimeType(const CURL &url, CStdString &content, CStdString useragent) { CFileCurl file; if (!useragent.IsEmpty()) file.SetUserAgent(useragent); struct __stat64 buffer; if( file.Stat(url, &buffer) == 0 ) { if (buffer.st_mode == _S_IFDIR) content = "x-directory/normal"; else content = file.GetMimeType(); CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> %s", url.Get().c_str(), content.c_str()); return true; } CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> failed", url.Get().c_str()); content = ""; return false; }