changeset 1518:eb46cc06389a

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 10:36:05 +0200
parents 4f8c8ef114db
children 8bd0d897763f
files Core/HttpServer/MongooseServer.cpp Core/RestApi/RestApiOutput.cpp Core/RestApi/RestApiOutput.h
diffstat 3 files changed, 1 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp	Tue Aug 11 10:32:34 2015 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Tue Aug 11 10:36:05 2015 +0200
@@ -980,6 +980,7 @@
   {
     Stop();
     httpCompression_ = enabled;
+    LOG(WARNING) << "HTTP compression is " << (enabled ? "enabled" : "disabled");
   }
 
   void MongooseServer::SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter)
--- a/Core/RestApi/RestApiOutput.cpp	Tue Aug 11 10:32:34 2015 +0200
+++ b/Core/RestApi/RestApiOutput.cpp	Tue Aug 11 10:36:05 2015 +0200
@@ -45,8 +45,6 @@
                                HttpMethod method) : 
     output_(output),
     method_(method),
-    allowDeflateCompression_(false),
-    allowGzipCompression_(false),
     convertJsonToXml_(false)
   {
     alreadySent_ = false;
@@ -80,32 +78,6 @@
   }
 
 
-  HttpCompression  RestApiOutput::GetPreferredCompression(size_t bodySize) const
-  {
-#if 0
-    // TODO
-    if (bodySize < 1024)
-    {
-      // Do not compress small answers
-      return HttpCompression_None;
-    }
-#endif    
-
-    if (allowGzipCompression_)
-    {
-      return HttpCompression_Gzip;
-    }
-    else if (allowDeflateCompression_)
-    {
-      return HttpCompression_Deflate;
-    }
-    else
-    {
-      return HttpCompression_None;
-    }
-  }
-
-
   void RestApiOutput::AnswerFile(HttpFileSender& sender)
   {
     CheckStatus();
--- a/Core/RestApi/RestApiOutput.h	Tue Aug 11 10:32:34 2015 +0200
+++ b/Core/RestApi/RestApiOutput.h	Tue Aug 11 10:36:05 2015 +0200
@@ -44,15 +44,11 @@
   private:
     HttpOutput&  output_;
     HttpMethod   method_;
-    bool         allowDeflateCompression_;
-    bool         allowGzipCompression_;
     bool         alreadySent_;
     bool         convertJsonToXml_;
 
     void CheckStatus();
 
-    HttpCompression  GetPreferredCompression(size_t bodySize) const;
-
   public:
     RestApiOutput(HttpOutput& output,
                   HttpMethod method);
@@ -79,16 +75,6 @@
       return convertJsonToXml_;
     }
 
-    void AllowDeflateCompression(bool allow)
-    {
-      allowDeflateCompression_ = allow;
-    }
-
-    void AllowGzipCompression(bool allow)
-    {
-      allowGzipCompression_ = allow;
-    }
-
     void AnswerFile(HttpFileSender& sender);
 
     void AnswerJson(const Json::Value& value);