Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp b/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
- index fccaaaf..05c8ca5 100644
- --- a/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
- +++ b/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
- @@ -174,6 +174,7 @@ PLT_HttpServer::ServeFile(const NPT_HttpRequest& request,
- NPT_InputStreamReference stream;
- NPT_File file(file_path);
- NPT_FileInfo file_info;
- + const char* content_type;
- // prevent hackers from accessing files outside of our root
- if ((file_path.Find("/..") >= 0) || (file_path.Find("\\..") >= 0) ||
- @@ -222,7 +223,12 @@ PLT_HttpServer::ServeFile(const NPT_HttpRequest& request,
- }
- PLT_HttpRequestContext tmp_context(request, context);
- - return ServeStream(request, context, response, stream, PLT_MimeType::GetMimeType(file_path, &tmp_context));
- + NPT_HttpEntity* entity = response.GetEntity();
- + if (entity->GetContentType().IsEmpty())
- + content_type = PLT_MimeType::GetMimeType(file_path, &tmp_context);
- + else
- + content_type = entity->GetContentType();
- + return ServeStream(request, context, response, stream, content_type);
- }
- /*----------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement