Advertisement
Guest User

Untitled

a guest
Feb 28th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. diff --git a/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp b/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
  2. index fccaaaf..05c8ca5 100644
  3. --- a/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
  4. +++ b/lib/libUPnP/Platinum/Source/Core/PltHttpServer.cpp
  5. @@ -174,6 +174,7 @@ PLT_HttpServer::ServeFile(const NPT_HttpRequest& request,
  6. NPT_InputStreamReference stream;
  7. NPT_File file(file_path);
  8. NPT_FileInfo file_info;
  9. + const char* content_type;
  10.  
  11. // prevent hackers from accessing files outside of our root
  12. if ((file_path.Find("/..") >= 0) || (file_path.Find("\\..") >= 0) ||
  13. @@ -222,7 +223,12 @@ PLT_HttpServer::ServeFile(const NPT_HttpRequest& request,
  14. }
  15.  
  16. PLT_HttpRequestContext tmp_context(request, context);
  17. - return ServeStream(request, context, response, stream, PLT_MimeType::GetMimeType(file_path, &tmp_context));
  18. + NPT_HttpEntity* entity = response.GetEntity();
  19. + if (entity->GetContentType().IsEmpty())
  20. + content_type = PLT_MimeType::GetMimeType(file_path, &tmp_context);
  21. + else
  22. + content_type = entity->GetContentType();
  23. + return ServeStream(request, context, response, stream, content_type);
  24. }
  25.  
  26. /*----------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement