|
Lines 47-68
Link Here
|
| 47 |
class OW_HTTP_API HTTPLengthLimitStreamBuffer : public BaseStreamBuffer |
47 |
class OW_HTTP_API HTTPLengthLimitStreamBuffer : public BaseStreamBuffer |
| 48 |
{ |
48 |
{ |
| 49 |
public: |
49 |
public: |
| 50 |
HTTPLengthLimitStreamBuffer(std::istream& istr, Int64 length); |
50 |
HTTPLengthLimitStreamBuffer(std::istream& istr, UInt64 length); |
| 51 |
virtual ~HTTPLengthLimitStreamBuffer(); |
51 |
virtual ~HTTPLengthLimitStreamBuffer(); |
| 52 |
/** |
52 |
/** |
| 53 |
* sets the Len to a new value, |
53 |
* sets the Len to a new value, |
| 54 |
* sets m_pos to zero, and m_isEnd to false |
54 |
* sets m_pos to zero, and m_isEnd to false |
| 55 |
*/ |
55 |
*/ |
| 56 |
void resetLen(Int64 len); |
56 |
void resetLen(UInt64 len); |
| 57 |
protected: |
57 |
protected: |
| 58 |
virtual int buffer_from_device(char* c, int n); |
58 |
virtual int buffer_from_device(char* c, int n); |
| 59 |
private: |
59 |
private: |
| 60 |
std::istream& m_istr; |
60 |
std::istream& m_istr; |
| 61 |
|
61 |
|
| 62 |
// holds the content length. |
62 |
// holds the content length. |
| 63 |
Int64 m_length; |
63 |
UInt64 m_length; |
| 64 |
// keeps track of how much we've read. |
64 |
// keeps track of how much we've read. |
| 65 |
Int64 m_pos; |
65 |
UInt64 m_pos; |
| 66 |
// keeps track if we are at end of length. |
66 |
// keeps track if we are at end of length. |
| 67 |
bool m_isEnd; |
67 |
bool m_isEnd; |
| 68 |
// prohibit copying and assigning |
68 |
// prohibit copying and assigning |
|
Lines 75-81
Link Here
|
| 75 |
class OW_HTTP_API HTTPLenLimitIStreamBase |
75 |
class OW_HTTP_API HTTPLenLimitIStreamBase |
| 76 |
{ |
76 |
{ |
| 77 |
public: |
77 |
public: |
| 78 |
HTTPLenLimitIStreamBase(std::istream& istr, Int64 length) |
78 |
HTTPLenLimitIStreamBase(std::istream& istr, UInt64 length) |
| 79 |
: m_strbuf(istr, length) {} |
79 |
: m_strbuf(istr, length) {} |
| 80 |
HTTPLengthLimitStreamBuffer m_strbuf; |
80 |
HTTPLengthLimitStreamBuffer m_strbuf; |
| 81 |
}; |
81 |
}; |
|
Lines 91-102
Link Here
|
| 91 |
* @param istr the original istream |
91 |
* @param istr the original istream |
| 92 |
* @param len the number of bytes to read before setting EOF. |
92 |
* @param len the number of bytes to read before setting EOF. |
| 93 |
*/ |
93 |
*/ |
| 94 |
HTTPLenLimitIStream(std::istream& istr, Int64 len); |
94 |
HTTPLenLimitIStream(std::istream& istr, UInt64 len); |
| 95 |
/** |
95 |
/** |
| 96 |
* Clear the EOF bit, and set the new length to len |
96 |
* Clear the EOF bit, and set the new length to len |
| 97 |
* @param len the new length to read before (re)setting EOF |
97 |
* @param len the new length to read before (re)setting EOF |
| 98 |
*/ |
98 |
*/ |
| 99 |
void resetLen(Int64 len); |
99 |
void resetLen(UInt64 len); |
| 100 |
private: |
100 |
private: |
| 101 |
std::istream& m_istr; |
101 |
std::istream& m_istr; |
| 102 |
|
102 |
|