#include <HTTP_StreamPolicy.h>
Public Types | |
typedef STREAM_BUFFER::char_type | char_type |
typedef ACE::IOS::String_OStreamBase < char_type > | buffer_type |
Public Member Functions | |
ChunkedTransferStreamPolicyBase () | |
virtual | ~ChunkedTransferStreamPolicyBase () |
Protected Member Functions | |
virtual int | read_from_stream (char_type *buffer, std::streamsize length) |
virtual int | write_to_stream (const char_type *buffer, std::streamsize length) |
int | getc () |
Private Attributes | |
std::streamsize | chunk_cnt_ |
buffer_type | chunk_ |
Definition at line 62 of file HTTP_StreamPolicy.h.
typedef ACE::IOS::String_OStreamBase<char_type> ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::buffer_type |
Definition at line 67 of file HTTP_StreamPolicy.h.
typedef STREAM_BUFFER::char_type ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::char_type |
Reimplemented from ACE::HTTP::StreamPolicyBase< STREAM_BUFFER >.
Definition at line 66 of file HTTP_StreamPolicy.h.
ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::ChunkedTransferStreamPolicyBase | ( | ) |
Definition at line 61 of file HTTP_StreamPolicy.cpp.
: StreamPolicyBase<STREAM_BUFFER> (), chunk_cnt_ (0) { }
ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::~ChunkedTransferStreamPolicyBase | ( | ) | [virtual] |
Definition at line 68 of file HTTP_StreamPolicy.cpp.
{ }
int ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::getc | ( | ) | [protected] |
Definition at line 73 of file HTTP_StreamPolicy.cpp.
{ static const int eof_ = std::char_traits<char_type>::eof (); char_type chbuf[1]; if (this->read_from_stream_i (chbuf, 1) <= 0) return eof_; else return chbuf[0]; }
int ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::read_from_stream | ( | char_type * | buffer, | |
std::streamsize | length | |||
) | [protected, virtual] |
Implements ACE::HTTP::StreamPolicyBase< STREAM_BUFFER >.
Definition at line 86 of file HTTP_StreamPolicy.cpp.
{ static const int eof_ = std::char_traits<char_type>::eof (); char_type lf = this->chunk_.widen ('\n'); if (this->chunk_cnt_ == 0) { int ch = this->getc (); while (std::isspace (ch)) ch = this->getc (); typename buffer_type::string_type chunk_len_str; while (std::isxdigit (ch)) { chunk_len_str += (char_type) ch; ch = this->getc (); } while (ch != eof_ && ch != lf) { ch = this->getc (); } ACE::IOS::String_IStreamBase<char_type> chunk_len_is (chunk_len_str); unsigned chunk_len; if (!(chunk_len_is >> chunk_len)) return eof_; this->chunk_cnt_ = (std::streamsize) chunk_len; } if (this->chunk_cnt_ > 0) { if (length > this->chunk_cnt_) length = this->chunk_cnt_; int n = this->read_from_stream_i (buf, length); if (n > 0) this->chunk_cnt_ -= n; return n; } else { int ch = this->getc (); while (ch != eof_ && ch != lf) ch = this->getc (); return 0; } }
int ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::write_to_stream | ( | const char_type * | buffer, | |
std::streamsize | length | |||
) | [protected, virtual] |
Implements ACE::HTTP::StreamPolicyBase< STREAM_BUFFER >.
Definition at line 134 of file HTTP_StreamPolicy.cpp.
{ this->chunk_.clear (); this->chunk_ << std::hex << length << std::dec; this->chunk_ << this->chunk_.widen ('\r') << this->chunk_.widen ('\n'); this->chunk_.write (buf, length); this->chunk_ << this->chunk_.widen ('\r') << this->chunk_.widen ('\n'); const typename buffer_type::string_type& str = this->chunk_.str (); return this->write_to_stream_i (str.c_str (), str.length ()); }
buffer_type ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::chunk_ [private] |
Definition at line 81 of file HTTP_StreamPolicy.h.
std::streamsize ACE::HTTP::ChunkedTransferStreamPolicyBase< STREAM_BUFFER >::chunk_cnt_ [private] |
Definition at line 80 of file HTTP_StreamPolicy.h.