Mercurial > hg > orthanc
comparison OrthancFramework/Sources/HttpServer/HttpOutput.h @ 5406:aaf7c49a9ddc am-http-compression
tentative to implement smart HTTP compression with detection of transfer syntax
author | Alain Mazy <am@osimis.io> |
---|---|
date | Sat, 04 Nov 2023 13:42:30 +0100 |
parents | 0ea402b4d901 |
children |
comparison
equal
deleted
inserted
replaced
5405:62bb63346185 | 5406:aaf7c49a9ddc |
---|---|
54 | 54 |
55 private: | 55 private: |
56 IHttpOutputStream& stream_; | 56 IHttpOutputStream& stream_; |
57 State state_; | 57 State state_; |
58 | 58 |
59 ContentCompression contentCompression_; | |
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 SetContentCompression(ContentCompression contentCompression); | |
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, |
137 | 142 |
138 void SetGzipAllowed(bool allowed); | 143 void SetGzipAllowed(bool allowed); |
139 | 144 |
140 bool IsGzipAllowed() const; | 145 bool IsGzipAllowed() const; |
141 | 146 |
147 bool IsContentCompressible() const | |
148 { | |
149 return stateMachine_.IsContentCompressible(); | |
150 } | |
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 |
146 void SendStatus(HttpStatus status); | 156 void SendStatus(HttpStatus status); |
149 const std::string& message); | 159 const std::string& message); |
150 | 160 |
151 void SetContentType(MimeType contentType); | 161 void SetContentType(MimeType contentType); |
152 | 162 |
153 void SetContentType(const std::string& contentType); | 163 void SetContentType(const std::string& contentType); |
164 | |
165 void SetContentCompression(ContentCompression contentCompression); | |
154 | 166 |
155 void SetContentFilename(const char* filename); | 167 void SetContentFilename(const char* filename); |
156 | 168 |
157 void SetCookie(const std::string& cookie, | 169 void SetCookie(const std::string& cookie, |
158 const std::string& value); | 170 const std::string& value); |