1//
2// HTTPIOStream.h
3//
4// Library: Net
5// Package: HTTP
6// Module: HTTPIOStream
7//
8// Definition of the HTTPIOStream class.
9//
10// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Net_HTTPIOStream_INCLUDED
18#define Net_HTTPIOStream_INCLUDED
19
20
21#include "Poco/Net/Net.h"
22#include "Poco/Net/HTTPResponse.h"
23#include "Poco/UnbufferedStreamBuf.h"
24
25
26namespace Poco {
27namespace Net {
28
29
30class HTTPClientSession;
31
32
33class Net_API HTTPResponseStreamBuf: public Poco::UnbufferedStreamBuf
34{
35public:
36 HTTPResponseStreamBuf(std::istream& istr);
37
38 ~HTTPResponseStreamBuf();
39
40private:
41 int readFromDevice();
42
43 std::istream& _istr;
44};
45
46
47inline int HTTPResponseStreamBuf::readFromDevice()
48{
49 return _istr.get();
50}
51
52
53class Net_API HTTPResponseIOS: public virtual std::ios
54{
55public:
56 HTTPResponseIOS(std::istream& istr);
57
58 ~HTTPResponseIOS();
59
60 HTTPResponseStreamBuf* rdbuf();
61
62protected:
63 HTTPResponseStreamBuf _buf;
64};
65
66
67inline HTTPResponseStreamBuf* HTTPResponseIOS::rdbuf()
68{
69 return &_buf;
70}
71
72
73class Net_API HTTPResponseStream: public HTTPResponseIOS, public std::istream
74{
75public:
76 HTTPResponseStream(std::istream& istr, HTTPClientSession* pSession);
77
78 ~HTTPResponseStream();
79
80private:
81 HTTPClientSession* _pSession;
82};
83
84
85} } // namespace Poco::Net
86
87
88#endif // Net_HTTPIOStream_INCLUDED
89