ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // See accompanying file COPYING.TXT file for licensing details.
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #include <cppcms/application.h>
  9. #include <cppcms/applications_pool.h>
  10. #include <string>
  11. #include <map>
  12. namespace cppcms {
  13. class service;
  14. namespace impl {
  15. class CPPCMS_API file_server : public application
  16. {
  17. public:
  18. static void normalize_path(std::string &path);
  19. file_server(cppcms::service &srv,bool async=false);
  20. ~file_server();
  21. virtual void main(std::string file_name);
  22. private:
  23. void list_dir(std::string const &url,std::string const &path);
  24. void show404();
  25. void load_mime_types(std::string);
  26. bool canonical(std::string normal,std::string &real);
  27. bool is_in_root(std::string const &normal,std::string const &root,std::string &real);
  28. bool check_in_document_root(std::string normal,std::string &real);
  29. int file_mode(std::string const &path);
  30. bool allow_deflate_;
  31. std::string document_root_;
  32. std::vector<std::pair<std::string,std::string> > alias_;
  33. typedef std::map<std::string,std::string> mime_type;
  34. mime_type mime_;
  35. bool list_directories_;
  36. bool check_symlinks_;
  37. bool async_;
  38. std::string index_file_;
  39. };
  40. }
  41. }