Mercurial > hg > orthanc
comparison Core/HttpServer/FilesystemHttpSender.cpp @ 217:1ac3aacd10a5
simplifications
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 12:22:23 +0100 |
parents | de640de989b8 |
children | 5459f05b4f54 |
comparison
equal
deleted
inserted
replaced
216:e5d5d4a9a326 | 217:1ac3aacd10a5 |
---|---|
37 | 37 |
38 namespace Orthanc | 38 namespace Orthanc |
39 { | 39 { |
40 void FilesystemHttpSender::Setup() | 40 void FilesystemHttpSender::Setup() |
41 { | 41 { |
42 boost::filesystem::path p(path_); | 42 //SetDownloadFilename(path_.filename().string()); |
43 SetFilename(p.filename().string()); | 43 SetContentType(Toolbox::AutodetectMimeType(path_.filename().string())); |
44 SetContentType(Toolbox::AutodetectMimeType(p.filename().string())); | |
45 } | 44 } |
46 | 45 |
47 uint64_t FilesystemHttpSender::GetFileSize() | 46 uint64_t FilesystemHttpSender::GetFileSize() |
48 { | 47 { |
49 return Toolbox::GetFileSize(path_); | 48 return Toolbox::GetFileSize(path_.string()); |
50 } | 49 } |
51 | 50 |
52 bool FilesystemHttpSender::SendData(HttpOutput& output) | 51 bool FilesystemHttpSender::SendData(HttpOutput& output) |
53 { | 52 { |
54 FILE* fp = fopen(path_.c_str(), "rb"); | 53 FILE* fp = fopen(path_.c_str(), "rb"); |
75 fclose(fp); | 74 fclose(fp); |
76 | 75 |
77 return true; | 76 return true; |
78 } | 77 } |
79 | 78 |
80 FilesystemHttpSender::FilesystemHttpSender(const char* path) : path_(path) | 79 FilesystemHttpSender::FilesystemHttpSender(const char* path) |
81 { | 80 { |
81 path_ = std::string(path); | |
82 Setup(); | |
83 } | |
84 | |
85 FilesystemHttpSender::FilesystemHttpSender(const boost::filesystem::path& path) | |
86 { | |
87 path_ = path; | |
82 Setup(); | 88 Setup(); |
83 } | 89 } |
84 | 90 |
85 FilesystemHttpSender::FilesystemHttpSender(const FileStorage& storage, | 91 FilesystemHttpSender::FilesystemHttpSender(const FileStorage& storage, |
86 const std::string& uuid) | 92 const std::string& uuid) |