CanvasImage: improve fetching from http and add mime detection.

This commit is contained in:
Thomas Geymayer
2014-03-20 01:44:31 +01:00
parent 01a43b49a5
commit fd51518d92
4 changed files with 56 additions and 17 deletions
+10
View File
@@ -272,6 +272,16 @@ std::string Request::hostAndPort() const
return u.substr(schemeEnd + 3, hostEnd - (schemeEnd + 3));
}
//------------------------------------------------------------------------------
std::string Request::responseMime() const
{
std::string content_type = _responseHeaders.get("content-type");
if( content_type.empty() )
return "application/octet-stream";
return content_type.substr(0, content_type.find(';'));
}
//------------------------------------------------------------------------------
void Request::setResponseLength(unsigned int l)
{