Mercurial > hg > orthanc
annotate OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.h @ 4302:4c91fbede7d2
missing macro CIVETWEB_KEEP_ALIVE_TIMEOUT_SECONDS
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 10:00:05 +0100 |
parents | db3932f9660d |
children | d9473bd5ed43 |
rev | line source |
---|---|
1525 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1525 | 4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
1525 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
1525 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
1525 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
1525 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "BufferHttpSender.h" | |
26 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
27 #include "../Compatibility.h" |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
28 |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
29 #include <memory> // For std::unique_ptr |
1525 | 30 |
31 namespace Orthanc | |
32 { | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
33 class ORTHANC_PUBLIC HttpStreamTranscoder : public IHttpStreamAnswer |
1525 | 34 { |
35 private: | |
36 IHttpStreamAnswer& source_; | |
37 CompressionType sourceCompression_; | |
38 uint64_t bytesToSkip_; | |
39 uint64_t skipped_; | |
40 uint64_t currentChunkOffset_; | |
1526
096a8af528c9
fix streams, initialization/finalization of libcurl and openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1525
diff
changeset
|
41 bool ready_; |
1525 | 42 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
43 std::unique_ptr<BufferHttpSender> uncompressed_; |
1525 | 44 |
45 void ReadSource(std::string& buffer); | |
46 | |
1526
096a8af528c9
fix streams, initialization/finalization of libcurl and openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1525
diff
changeset
|
47 HttpCompression SetupZlibCompression(bool deflateAllowed); |
096a8af528c9
fix streams, initialization/finalization of libcurl and openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1525
diff
changeset
|
48 |
1525 | 49 public: |
50 HttpStreamTranscoder(IHttpStreamAnswer& source, | |
4298 | 51 CompressionType compression); |
1525 | 52 |
53 // This is the first method to be called | |
54 virtual HttpCompression SetupHttpCompression(bool gzipAllowed, | |
4201 | 55 bool deflateAllowed) ORTHANC_OVERRIDE; |
1525 | 56 |
4298 | 57 virtual bool HasContentFilename(std::string& filename) ORTHANC_OVERRIDE; |
1525 | 58 |
4298 | 59 virtual std::string GetContentType() ORTHANC_OVERRIDE; |
1525 | 60 |
4201 | 61 virtual uint64_t GetContentLength() ORTHANC_OVERRIDE; |
1525 | 62 |
4201 | 63 virtual bool ReadNextChunk() ORTHANC_OVERRIDE; |
1525 | 64 |
4201 | 65 virtual const char* GetChunkContent() ORTHANC_OVERRIDE; |
1525 | 66 |
4201 | 67 virtual size_t GetChunkSize() ORTHANC_OVERRIDE; |
1525 | 68 }; |
69 } |