forked from RipcordSoftware/libhttpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultipart_response_stream.h
More file actions
44 lines (27 loc) · 1.13 KB
/
Copy pathmultipart_response_stream.h
File metadata and controls
44 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef RS_LIBHTTPSERVER_MULTIPART_RESPONSE_STREAM_H
#define RS_LIBHTTPSERVER_MULTIPART_RESPONSE_STREAM_H
#include "stream.h"
#include "response_headers.h"
namespace rs {
namespace httpserver {
class MultipartResponseStream final : public Stream {
public:
MultipartResponseStream(Stream& stream);
MultipartResponseStream(const MultipartResponseStream&) = delete;
virtual void Flush() override;
virtual int Read(Stream::byte* buffer, int offset, int count, bool peek = false) override;
virtual int Write(const Stream::byte* buffer, int offset, int count) override;
virtual long getPosition() override;
virtual long getLength() override;
void EmitPart(const char* contentType, const char* filename = nullptr, std::int64_t contentLength = -1);
unsigned getPartCount() { return partCount_; }
static const char* boundary;
private:
static const char* boundaryStart;
static const char* boundaryEnd;
static const unsigned boundaryEndLength;
Stream& stream_;
unsigned partCount_{0};
};
}}
#endif /* RS_LIBHTTPSERVER_MULTIPART_RESPONSE_STREAM_H */