comparison OrthancFramework/Sources/HttpServer/HttpOutput.h @ 5407:3206537cbb56

HttpCompression: now disabled by default + only compress known compressible content types
author Alain Mazy <am@osimis.io>
date Sat, 04 Nov 2023 14:46:38 +0100
parents 0ea402b4d901
children 514fd39f87a8
comparison
equal deleted inserted replaced
5405:62bb63346185 5407:3206537cbb56
54 54
55 private: 55 private:
56 IHttpOutputStream& stream_; 56 IHttpOutputStream& stream_;
57 State state_; 57 State state_;
58 58
59 bool isContentCompressible_;
59 HttpStatus status_; 60 HttpStatus status_;
60 bool hasContentLength_; 61 bool hasContentLength_;
61 uint64_t contentLength_; 62 uint64_t contentLength_;
62 uint64_t contentPosition_; 63 uint64_t contentPosition_;
63 bool keepAlive_; 64 bool keepAlive_;
80 81
81 void SetContentLength(uint64_t length); 82 void SetContentLength(uint64_t length);
82 83
83 void SetContentType(const char* contentType); 84 void SetContentType(const char* contentType);
84 85
86 void SetContentCompressible(bool isCompressible);
87
85 void SetContentFilename(const char* filename); 88 void SetContentFilename(const char* filename);
86 89
87 void SetCookie(const std::string& cookie, 90 void SetCookie(const std::string& cookie,
88 const std::string& value); 91 const std::string& value);
89 92
108 State GetState() const 111 State GetState() const
109 { 112 {
110 return state_; 113 return state_;
111 } 114 }
112 115
116 bool IsContentCompressible() const;
117
113 void CheckHeadersCompatibilityWithMultipart() const; 118 void CheckHeadersCompatibilityWithMultipart() const;
114 119
115 void StartStream(const std::string& contentType); 120 void StartStream(const std::string& contentType);
116 121
117 void SendStreamItem(const void* data, 122 void SendStreamItem(const void* data,
136 bool IsDeflateAllowed() const; 141 bool IsDeflateAllowed() const;
137 142
138 void SetGzipAllowed(bool allowed); 143 void SetGzipAllowed(bool allowed);
139 144
140 bool IsGzipAllowed() const; 145 bool IsGzipAllowed() const;
146
147 bool IsContentCompressible() const
148 {
149 return stateMachine_.IsContentCompressible();
150 }
141 151
142 void SendStatus(HttpStatus status, 152 void SendStatus(HttpStatus status,
143 const char* message, 153 const char* message,
144 size_t messageSize); 154 size_t messageSize);
145 155