00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef IDENTITYSTREAMBUF_H
00016 #define IDENTITYSTREAMBUF_H
00017
00018 #include "pandabase.h"
00019
00020
00021 #ifdef HAVE_OPENSSL
00022
00023 #include "bioStreamPtr.h"
00024 #include "pointerTo.h"
00025 #include "socketStream.h"
00026
00027 class HTTPChannel;
00028
00029
00030
00031
00032
00033
00034 class EXPCL_PANDAEXPRESS IdentityStreamBuf : public streambuf {
00035 public:
00036 IdentityStreamBuf();
00037 virtual ~IdentityStreamBuf();
00038
00039 void open_read(BioStreamPtr *source, HTTPChannel *doc,
00040 bool has_content_length, size_t content_length);
00041 void close_read();
00042
00043 INLINE bool is_closed() const;
00044 INLINE ISocketStream::ReadState get_read_state() const;
00045
00046 protected:
00047 virtual int underflow();
00048
00049 private:
00050 size_t read_chars(char *start, size_t length);
00051
00052 PT(BioStreamPtr) _source;
00053 bool _has_content_length;
00054 size_t _bytes_remaining;
00055 bool _wanted_nonblocking;
00056 ISocketStream::ReadState _read_state;
00057 char *_buffer;
00058
00059 friend class IIdentityStream;
00060 };
00061
00062 #include "identityStreamBuf.I"
00063
00064 #endif // HAVE_OPENSSL
00065
00066 #endif