comparison Core/HttpServer/FilesystemHttpHandler.cpp @ 217:1ac3aacd10a5

simplifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2012 12:22:23 +0100
parents fe180eae201d
children 64925c94825c
comparison
equal deleted inserted replaced
216:e5d5d4a9a326 217:1ac3aacd10a5
31 31
32 32
33 #include "FilesystemHttpHandler.h" 33 #include "FilesystemHttpHandler.h"
34 34
35 #include "../OrthancException.h" 35 #include "../OrthancException.h"
36 #include "FilesystemHttpSender.h"
36 37
37 #include <boost/filesystem.hpp> 38 #include <boost/filesystem.hpp>
38 39
39 40
40 namespace Orthanc 41 namespace Orthanc
51 const UriComponents& uri, 52 const UriComponents& uri,
52 const boost::filesystem::path& p) 53 const boost::filesystem::path& p)
53 { 54 {
54 namespace fs = boost::filesystem; 55 namespace fs = boost::filesystem;
55 56
56 output.SendOkHeader("text/html"); 57 output.SendCustomOkHeader("Content-Type: text/html\r\n");
57 output.SendString("<html>"); 58 output.SendString("<html>");
58 output.SendString(" <body>"); 59 output.SendString(" <body>");
59 output.SendString(" <h1>Subdirectories</h1>"); 60 output.SendString(" <h1>Subdirectories</h1>");
60 output.SendString(" <ul>"); 61 output.SendString(" <ul>");
61 62
146 p /= uri[i]; 147 p /= uri[i];
147 } 148 }
148 149
149 if (fs::exists(p) && fs::is_regular_file(p)) 150 if (fs::exists(p) && fs::is_regular_file(p))
150 { 151 {
151 output.AnswerFileAutodetectContentType(p.string()); 152 FilesystemHttpSender(p).Send(output);
153
154 //output.AnswerFileAutodetectContentType(p.string());
152 } 155 }
153 else if (listDirectoryContent_ && 156 else if (listDirectoryContent_ &&
154 fs::exists(p) && 157 fs::exists(p) &&
155 fs::is_directory(p)) 158 fs::is_directory(p))
156 { 159 {