diff Core/HttpServer/HttpOutput.cpp @ 217:1ac3aacd10a5

simplifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2012 12:22:23 +0100
parents 7f74209ea0f8
children 64925c94825c
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp	Thu Nov 29 11:57:35 2012 +0100
+++ b/Core/HttpServer/HttpOutput.cpp	Thu Nov 29 12:22:23 2012 +0100
@@ -44,12 +44,9 @@
   void HttpOutput::SendString(const std::string& s)
   {
     if (s.size() > 0)
+    {
       Send(&s[0], s.size());
-  }
-
-  void HttpOutput::SendOkHeader(const std::string& contentType)
-  {
-    SendOkHeader(contentType.c_str(), false, 0, NULL);
+    }
   }
 
   void HttpOutput::SendOkHeader(const char* contentType,
@@ -135,59 +132,6 @@
     Send(buffer, size);
   }
 
-
-  void HttpOutput::AnswerFileWithContentType(const std::string& path,
-                                             const std::string& contentType,
-                                             const char* filename)
-  {
-    uint64_t fileSize = Toolbox::GetFileSize(path);
-  
-    FILE* fp = fopen(path.c_str(), "rb");
-    if (!fp)
-    {
-      SendHeaderInternal(Orthanc_HttpStatus_500_InternalServerError);
-      return;
-    }
-  
-    SendOkHeader(contentType.c_str(), true, fileSize, filename);
-
-    std::vector<uint8_t> buffer(1024 * 1024);  // Chunks of 1MB
-
-    for (;;)
-    {
-      size_t nbytes = fread(&buffer[0], 1, buffer.size(), fp);
-      if (nbytes == 0)
-      {
-        break;
-      }
-      else
-      {
-        Send(&buffer[0], nbytes);
-      }
-    }
-
-    fclose(fp);
-  }
-
-
-  void HttpOutput::AnswerFileAutodetectContentType(const std::string& path,
-                                                   const char* filename)
-  {
-    AnswerFileWithContentType(path, Toolbox::AutodetectMimeType(path), filename);
-  }
-
-
-  void HttpOutput::AnswerFile(const FileStorage& storage,
-                              const std::string& uuid,
-                              const std::string& contentType,
-                              const char* filename)
-  {
-    boost::filesystem::path p(storage.GetPath(uuid));
-    AnswerFileWithContentType(p.string(), contentType, filename);
-  }
-
-
-
   void HttpOutput::Redirect(const std::string& path)
   {
     std::string s =