2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-04-12 04:21:09 +02:00
|
|
|
|
2015-06-22 11:11:21 +02:00
|
|
|
#ifndef HTTPCHUNKEDENCODING_H
|
|
|
|
#define HTTPCHUNKEDENCODING_H
|
2014-04-12 04:21:09 +02:00
|
|
|
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "remote/i2-remote.hpp"
|
2015-06-22 11:11:21 +02:00
|
|
|
#include "base/stream.hpp"
|
2014-04-12 04:21:09 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2015-06-22 11:11:21 +02:00
|
|
|
struct ChunkReadContext
|
2014-05-03 20:02:22 +02:00
|
|
|
{
|
2015-06-22 11:11:21 +02:00
|
|
|
StreamReadContext& StreamContext;
|
|
|
|
int LengthIndicator;
|
2014-05-03 20:02:22 +02:00
|
|
|
|
2015-06-22 11:11:21 +02:00
|
|
|
ChunkReadContext(StreamReadContext& scontext)
|
2017-12-19 15:50:05 +01:00
|
|
|
: StreamContext(scontext), LengthIndicator(-1)
|
2015-06-22 11:11:21 +02:00
|
|
|
{ }
|
|
|
|
};
|
2014-12-09 13:17:27 +01:00
|
|
|
|
2014-04-12 04:21:09 +02:00
|
|
|
/**
|
2015-06-22 11:11:21 +02:00
|
|
|
* HTTP chunked encoding.
|
2014-04-12 04:21:09 +02:00
|
|
|
*
|
2014-05-03 20:02:22 +02:00
|
|
|
* @ingroup remote
|
2014-04-12 04:21:09 +02:00
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
struct HttpChunkedEncoding
|
2014-04-12 04:21:09 +02:00
|
|
|
{
|
2015-06-22 11:11:21 +02:00
|
|
|
static StreamReadStatus ReadChunkFromStream(const Stream::Ptr& stream,
|
2017-12-19 15:50:05 +01:00
|
|
|
char **data, size_t *size, ChunkReadContext& ccontext, bool may_wait = false);
|
2015-06-22 11:11:21 +02:00
|
|
|
static void WriteChunkToStream(const Stream::Ptr& stream, const char *data, size_t count);
|
2015-02-26 12:41:47 +01:00
|
|
|
|
2014-04-12 04:21:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-22 11:11:21 +02:00
|
|
|
#endif /* HTTPCHUNKEDENCODING_H */
|