00001 // Filename: chunkedStream.cxx 00002 // Created by: drose (25Sep02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "chunkedStream.h" 00016 00017 // This module is not compiled if OpenSSL is not available. 00018 #ifdef HAVE_OPENSSL 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: IChunkedStream::Destructor 00022 // Access: Published, Virtual 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 IChunkedStream:: 00026 ~IChunkedStream() { 00027 if (_channel != (HTTPChannel *)NULL) { 00028 _channel->body_stream_destructs(this); 00029 _channel = NULL; 00030 } 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: IChunkedStream::is_closed 00035 // Access: Public, Virtual 00036 // Description: Returns true if the last eof condition was triggered 00037 // because the socket has genuinely closed, or false if 00038 // we can expect more data to come along shortly. 00039 //////////////////////////////////////////////////////////////////// 00040 bool IChunkedStream:: 00041 is_closed() { 00042 if (_buf._done || _buf.is_closed()) { 00043 return true; 00044 } 00045 clear(); 00046 return false; 00047 } 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function: IChunkedStream::close 00051 // Access: Public, Virtual 00052 // Description: Resets the ChunkedStream to empty, but does not actually 00053 // close the source BIO unless owns_source was true. 00054 //////////////////////////////////////////////////////////////////// 00055 void IChunkedStream:: 00056 close() { 00057 _buf.close_read(); 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: IChunkedStream::get_read_state 00062 // Access: Public, Virtual 00063 // Description: Returns an enum indicating how we are coming along in 00064 // reading the document. 00065 //////////////////////////////////////////////////////////////////// 00066 IChunkedStream::ReadState IChunkedStream:: 00067 get_read_state() { 00068 return _buf.get_read_state(); 00069 } 00070 00071 #endif // HAVE_OPENSSL