]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/HTTPRequest.cxx
CanvasImage: improve fetching from http and add mime detection.
[simgear.git] / simgear / io / HTTPRequest.cxx
index 46c64d5df84654c3698df0f72b59fab81ecd2de0..535ec402da8fa9c043ded3de7f9f7e0d0238fa63 100644 (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)
 {