Преглед изворни кода

HTTPDocument -> HTTPChannel

David Rose пре 23 година
родитељ
комит
6fb86ad474

+ 3 - 3
panda/src/downloader/Sources.pp

@@ -19,7 +19,7 @@
     chunkedStream.I chunkedStream.h chunkedStreamBuf.h \
     extractor.h \
     httpClient.I httpClient.h \
-    httpDocument.I httpDocument.h \
+    httpChannel.I httpChannel.h \
     identityStream.I identityStream.h identityStreamBuf.h \
     multiplexStream.I multiplexStream.h \
     multiplexStreamBuf.I multiplexStreamBuf.h \
@@ -38,7 +38,7 @@
     chunkedStream.cxx chunkedStreamBuf.cxx \
     extractor.cxx \
     httpClient.cxx \
-    httpDocument.cxx \
+    httpChannel.cxx \
     identityStream.cxx identityStreamBuf.cxx \
     multiplexStream.cxx multiplexStreamBuf.cxx \
     urlSpec.cxx \
@@ -57,7 +57,7 @@
     downloader.h downloader.I \
     extractor.h \
     httpClient.I httpClient.h \
-    httpDocument.I httpDocument.h \
+    httpChannel.I httpChannel.h \
     identityStream.I identityStream.h identityStreamBuf.h \
     multiplexStream.I multiplexStream.h \
     multiplexStreamBuf.I multiplexStreamBuf.I \

+ 1 - 1
panda/src/downloader/bioStream.h

@@ -31,7 +31,7 @@
 //       Class : IBioStream
 // Description : An input stream object that reads data from an
 //               OpenSSL BIO object.  This is used by the HTTPClient
-//               and HTTPDocument classes to provide a C++ interface
+//               and HTTPChannel classes to provide a C++ interface
 //               to OpenSSL.
 //
 //               Seeking is not supported.

+ 2 - 2
panda/src/downloader/chunkedStream.I

@@ -32,7 +32,7 @@ IChunkedStream() : ISocketStream(&_buf) {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE IChunkedStream::
-IChunkedStream(BioStreamPtr *source, HTTPDocument *doc) : ISocketStream(&_buf) {
+IChunkedStream(BioStreamPtr *source, HTTPChannel *doc) : ISocketStream(&_buf) {
   open(source, doc);
 }
 
@@ -42,7 +42,7 @@ IChunkedStream(BioStreamPtr *source, HTTPDocument *doc) : ISocketStream(&_buf) {
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 INLINE IChunkedStream &IChunkedStream::
-open(BioStreamPtr *source, HTTPDocument *doc) {
+open(BioStreamPtr *source, HTTPChannel *doc) {
   clear(0);
   _buf.open_read(source, doc);
   return *this;

+ 3 - 3
panda/src/downloader/chunkedStream.h

@@ -27,7 +27,7 @@
 #include "socketStream.h"
 #include "chunkedStreamBuf.h"
 
-class HTTPDocument;
+class HTTPChannel;
 class BioStreamPtr;
 
 ////////////////////////////////////////////////////////////////////
@@ -42,9 +42,9 @@ class BioStreamPtr;
 class IChunkedStream : public ISocketStream {
 public:
   INLINE IChunkedStream();
-  INLINE IChunkedStream(BioStreamPtr *source, HTTPDocument *doc);
+  INLINE IChunkedStream(BioStreamPtr *source, HTTPChannel *doc);
 
-  INLINE IChunkedStream &open(BioStreamPtr *source, HTTPDocument *doc);
+  INLINE IChunkedStream &open(BioStreamPtr *source, HTTPChannel *doc);
   INLINE IChunkedStream &close();
 
   virtual bool is_closed();

+ 5 - 5
panda/src/downloader/chunkedStreamBuf.cxx

@@ -70,13 +70,13 @@ ChunkedStreamBuf::
 //               from the chunked encoding.
 ////////////////////////////////////////////////////////////////////
 void ChunkedStreamBuf::
-open_read(BioStreamPtr *source, HTTPDocument *doc) {
+open_read(BioStreamPtr *source, HTTPChannel *doc) {
   _source = source;
   _chunk_remaining = 0;
   _done = false;
   _doc = doc;
 
-  if (_doc != (HTTPDocument *)NULL) {
+  if (_doc != (HTTPChannel *)NULL) {
     _read_index = doc->_read_index;
     _doc->_file_size = 0;
 
@@ -161,13 +161,13 @@ read_chars(char *start, size_t length) {
   if (chunk_size == 0) {
     // Last chunk; we're done.
     _done = true;
-    if (_doc != (HTTPDocument *)NULL && _read_index == _doc->_read_index) {
-      _doc->_state = HTTPDocument::S_read_body;
+    if (_doc != (HTTPChannel *)NULL && _read_index == _doc->_read_index) {
+      _doc->_state = HTTPChannel::S_read_body;
     }
     return 0;
   }
 
-  if (_doc != (HTTPDocument *)NULL && _read_index == _doc->_read_index) {
+  if (_doc != (HTTPChannel *)NULL && _read_index == _doc->_read_index) {
     _doc->_file_size += chunk_size;
   }
 

+ 3 - 3
panda/src/downloader/chunkedStreamBuf.h

@@ -24,7 +24,7 @@
 // This module is not compiled if OpenSSL is not available.
 #ifdef HAVE_SSL
 
-#include "httpDocument.h"
+#include "httpChannel.h"
 #include "bioStreamPtr.h"
 #include "pointerTo.h"
 
@@ -39,7 +39,7 @@ public:
   ChunkedStreamBuf();
   virtual ~ChunkedStreamBuf();
 
-  void open_read(BioStreamPtr *source, HTTPDocument *doc);
+  void open_read(BioStreamPtr *source, HTTPChannel *doc);
   void close_read();
 
 protected:
@@ -52,7 +52,7 @@ private:
   size_t _chunk_remaining;
   bool _done;
 
-  PT(HTTPDocument) _doc;
+  PT(HTTPChannel) _doc;
   int _read_index;
 
   friend class IChunkedStream;

+ 2 - 2
panda/src/downloader/config_downloader.cxx

@@ -19,7 +19,7 @@
 #include "dconfig.h"
 #include "get_config_path.h"
 #include "config_downloader.h"
-#include "httpDocument.h"
+#include "httpChannel.h"
 
 
 Configure(config_downloader);
@@ -80,6 +80,6 @@ config_downloader.GetBool("verify-ssl", true);
 
 ConfigureFn(config_downloader) {
 #ifdef HAVE_SSL
-  HTTPDocument::init_type();
+  HTTPChannel::init_type();
 #endif
 }

+ 1 - 1
panda/src/downloader/downloader_composite1.cxx

@@ -8,7 +8,7 @@
 #include "chunkedStreamBuf.cxx"
 #include "extractor.cxx"
 #include "httpClient.cxx"
-#include "httpDocument.cxx"
+#include "httpChannel.cxx"
 #include "identityStream.cxx"
 #include "identityStreamBuf.cxx"
 #include "multiplexStream.cxx"

+ 44 - 41
panda/src/downloader/httpDocument.I → panda/src/downloader/httpChannel.I

@@ -1,4 +1,4 @@
-// Filename: httpDocument.I
+// Filename: httpChannel.I
 // Created by:  drose (24Sep02)
 //
 ////////////////////////////////////////////////////////////////////
@@ -18,78 +18,82 @@
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::is_valid
+//     Function: HTTPChannel::is_valid
 //       Access: Published
-//  Description: Returns true if the document was successfully
-//               retrieved and is ready to be read, false otherwise.
+//  Description: Returns true if the last-requested document was
+//               successfully retrieved and is ready to be read, false
+//               otherwise.
 ////////////////////////////////////////////////////////////////////
-INLINE bool HTTPDocument::
+INLINE bool HTTPChannel::
 is_valid() const {
   return (!_source.is_null() && (_status_code / 100) == 2);
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_url
+//     Function: HTTPChannel::get_url
 //       Access: Published
-//  Description: Returns the URL that was used to retrieve this
-//               document: whatever URL was last passed to
-//               get_document() or get_header().
-////////////////////////////////////////////////////////////////////
-INLINE const URLSpec &HTTPDocument::
+//  Description: Returns the URL that was used to retrieve the
+//               most recent document: whatever URL was last passed to
+//               get_document() or get_header().  If a redirect has
+//               transparently occurred, this will return the new,
+//               redirected URL (the actual URL at which the document
+//               was located).
+////////////////////////////////////////////////////////////////////
+INLINE const URLSpec &HTTPChannel::
 get_url() const {
   return _url;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_http_version
+//     Function: HTTPChannel::get_http_version
 //       Access: Published
 //  Description: Returns the HTTP version number returned by the
 //               server, as one of the HTTPClient enumerated types,
 //               e.g. HTTPClient::HV_11.
 ////////////////////////////////////////////////////////////////////
-INLINE HTTPClient::HTTPVersion HTTPDocument::
+INLINE HTTPClient::HTTPVersion HTTPChannel::
 get_http_version() const {
   return _http_version;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_http_version_string
+//     Function: HTTPChannel::get_http_version_string
 //       Access: Published
 //  Description: Returns the HTTP version number returned by the
 //               server, formatted as a string, e.g. "HTTP/1.1".
 ////////////////////////////////////////////////////////////////////
-INLINE const string &HTTPDocument::
+INLINE const string &HTTPChannel::
 get_http_version_string() const {
   return _http_version_string;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_status_code
+//     Function: HTTPChannel::get_status_code
 //       Access: Published
 //  Description: Returns the HTML return code from the document
 //               retrieval request.  This will be in the 200 range if
 //               the document is successfully retrieved, or some other
 //               value in the case of an error.
 ////////////////////////////////////////////////////////////////////
-INLINE int HTTPDocument::
+INLINE int HTTPChannel::
 get_status_code() const {
   return _status_code;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_status_string
+//     Function: HTTPChannel::get_status_string
 //       Access: Published
 //  Description: Returns the string as returned by the server
 //               describing the status code for humans.  This may or
 //               may not be meaningful.
 ////////////////////////////////////////////////////////////////////
-INLINE const string &HTTPDocument::
+INLINE const string &HTTPChannel::
 get_status_string() const {
   return _status_string;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_realm
+//     Function: HTTPChannel::get_realm
 //       Access: Published
 //  Description: If the document failed to connect because of a 401
 //               (Authorization required) or 407 (Proxy authorization
@@ -106,13 +110,13 @@ get_status_string() const {
 //               or 407 error, then the client code and the server do
 //               not have a common scheme for exchanging passwords.
 ////////////////////////////////////////////////////////////////////
-INLINE const string &HTTPDocument::
+INLINE const string &HTTPChannel::
 get_realm() const {
   return _realm;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_redirect
+//     Function: HTTPChannel::get_redirect
 //       Access: Published
 //  Description: If the document failed with a redirect code (300
 //               series), this will generally contain the new URL the
@@ -122,15 +126,15 @@ get_realm() const {
 //               and get_redirect() will return empty, but get_url()
 //               will return the new, redirected URL.
 ////////////////////////////////////////////////////////////////////
-INLINE const URLSpec &HTTPDocument::
+INLINE const URLSpec &HTTPChannel::
 get_redirect() const {
   return _redirect;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::set_persistent_connection
+//     Function: HTTPChannel::set_persistent_connection
 //       Access: Published
-//  Description: Indicates whether the HTTPDocument should try to keep
+//  Description: Indicates whether the HTTPChannel should try to keep
 //               the connection to the server open and reuse that
 //               connection for multiple documents, or whether it
 //               should close the connection and open a new one for
@@ -138,32 +142,31 @@ get_redirect() const {
 //               around when possible, false to recycle them.
 //
 //               It makes most sense to set this false when the
-//               HTTPDocument will be used only once to retrieve a
-//               single document, true when you will be using the
-//               HTTPDocument interface to retrieve multiple
-//               documents.
+//               HTTPChannel will be used only once to retrieve a
+//               single document, true when you will be using the same
+//               HTTPChannel object to retrieve multiple documents.
 ////////////////////////////////////////////////////////////////////
-INLINE void HTTPDocument::
+INLINE void HTTPChannel::
 set_persistent_connection(bool persistent_connection) {
   _persistent_connection = persistent_connection;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_persistent_connection
+//     Function: HTTPChannel::get_persistent_connection
 //       Access: Published
-//  Description: Returns whether the HTTPDocument should try to keep
+//  Description: Returns whether the HTTPChannel should try to keep
 //               the connection to the server open and reuse that
 //               connection for multiple documents, or whether it
 //               should close the connection and open a new one for
 //               each request.  See set_persistent_connection().
 ////////////////////////////////////////////////////////////////////
-INLINE bool HTTPDocument::
+INLINE bool HTTPChannel::
 get_persistent_connection() const {
   return _persistent_connection;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_file_size
+//     Function: HTTPChannel::get_file_size
 //       Access: Published
 //  Description: Returns the size of the file, if it is known.
 //               Returns 0 if the file size is not known.  
@@ -176,35 +179,35 @@ get_persistent_connection() const {
 //               their minds midstream about how much data they're
 //               sending you.
 ////////////////////////////////////////////////////////////////////
-INLINE size_t HTTPDocument::
+INLINE size_t HTTPChannel::
 get_file_size() const {
   return _file_size;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::post_form
+//     Function: HTTPChannel::post_form
 //       Access: Published
 //  Description: Posts form data to a particular URL and retrieves the
 //               response.
 ////////////////////////////////////////////////////////////////////
-INLINE bool HTTPDocument::
+INLINE bool HTTPChannel::
 post_form(const URLSpec &url, const string &body) {
   return send_request("POST", url, body);
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_document
+//     Function: HTTPChannel::get_document
 //       Access: Published
 //  Description: Opens the named document for reading, if available.
 //               Returns true if successful, false otherwise.
 ////////////////////////////////////////////////////////////////////
-INLINE bool HTTPDocument::
+INLINE bool HTTPChannel::
 get_document(const URLSpec &url) {
   return send_request("GET", url, string());
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_header
+//     Function: HTTPChannel::get_header
 //       Access: Published
 //  Description: Like get_document(), except only the header
 //               associated with the document is retrieved.  This may
@@ -212,7 +215,7 @@ get_document(const URLSpec &url) {
 //               might also return the size of the document (if the
 //               server gives us this information).
 ////////////////////////////////////////////////////////////////////
-INLINE bool HTTPDocument::
+INLINE bool HTTPChannel::
 get_header(const URLSpec &url) {
   return send_request("HEAD", url, string());
 }

+ 82 - 82
panda/src/downloader/httpDocument.cxx → panda/src/downloader/httpChannel.cxx

@@ -1,4 +1,4 @@
-// Filename: httpDocument.cxx
+// Filename: httpChannel.cxx
 // Created by:  drose (24Sep02)
 //
 ////////////////////////////////////////////////////////////////////
@@ -16,7 +16,7 @@
 //
 ////////////////////////////////////////////////////////////////////
 
-#include "httpDocument.h"
+#include "httpChannel.h"
 #include "httpClient.h"
 #include "bioStream.h"
 #include "chunkedStream.h"
@@ -24,7 +24,7 @@
 
 #ifdef HAVE_SSL
 
-TypeHandle HTTPDocument::_type_handle;
+TypeHandle HTTPChannel::_type_handle;
 
 static const char base64_table[64] = {
   'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
@@ -38,12 +38,12 @@ static const char base64_table[64] = {
 };
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::Constructor
+//     Function: HTTPChannel::Constructor
 //       Access: Private
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-HTTPDocument::
-HTTPDocument(HTTPClient *client) :
+HTTPChannel::
+HTTPChannel(HTTPClient *client) :
   _client(client)
 {
   _persistent_connection = false;
@@ -58,18 +58,18 @@ HTTPDocument(HTTPClient *client) :
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::send_request
+//     Function: HTTPChannel::send_request
 //       Access: Private
 //  Description: This is normally called immediately after
 //               construction to send the request to the server and
 //               read the response.  It can't be called as part of the
 //               constructor because it may involve an up-and-down
-//               change in the reference count of the HTTPDocument
+//               change in the reference count of the HTTPChannel
 //               object, which would inadvertently cause the object to
 //               be deleted if it hasn't returned from its constructor
 //               yet!
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 send_request(const string &method, const URLSpec &url, const string &body) {
   // Let's call this before we call make_header(), so we'll get the
   // right HTTP version and proxy information etc.
@@ -115,13 +115,13 @@ send_request(const string &method, const URLSpec &url, const string &body) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::send_request
+//     Function: HTTPChannel::send_request
 //       Access: Private
 //  Description: This is a lower-level interface than the above
 //               send_request(); it accepts a header and body string
 //               that have already been defined.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 send_request(const string &header, const string &body, bool allow_reconnect) {
   if (prepare_for_next(allow_reconnect)) {
     // Tack on a proxy authorization if it is called for.  Assume we
@@ -173,57 +173,57 @@ send_request(const string &header, const string &body, bool allow_reconnect) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::Destructor
+//     Function: HTTPChannel::Destructor
 //       Access: Public, Virtual
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-HTTPDocument::
-~HTTPDocument() {
+HTTPChannel::
+~HTTPChannel() {
   free_bio();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_file_system
+//     Function: HTTPChannel::get_file_system
 //       Access: Published, Virtual
 //  Description: Returns the VirtualFileSystem this file is associated
 //               with.
 ////////////////////////////////////////////////////////////////////
-VirtualFileSystem *HTTPDocument::
+VirtualFileSystem *HTTPChannel::
 get_file_system() const {
   return NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_filename
+//     Function: HTTPChannel::get_filename
 //       Access: Published, Virtual
 //  Description: Returns the full pathname to this file within the
 //               virtual file system.
 ////////////////////////////////////////////////////////////////////
-Filename HTTPDocument::
+Filename HTTPChannel::
 get_filename() const {
   return Filename();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::is_regular_file
+//     Function: HTTPChannel::is_regular_file
 //       Access: Published, Virtual
 //  Description: Returns true if this file represents a regular file
 //               (and read_file() may be called), false otherwise.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 is_regular_file() const {
   return is_valid();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::will_close_connection
+//     Function: HTTPChannel::will_close_connection
 //       Access: Public
 //  Description: Returns true if the server has indicated it will
 //               close the connection after this document has been
 //               read, or false if it will remain open (and future
 //               documents may be requested on the same connection).
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 will_close_connection() const {
   if (get_http_version() < HTTPClient::HV_11) {
     // pre-HTTP 1.1 always closes.
@@ -241,27 +241,27 @@ will_close_connection() const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::open_read_file
+//     Function: HTTPChannel::open_read_file
 //       Access: Public, Virtual
 //  Description: Opens the document for reading.  Returns a newly
 //               allocated istream on success (which you should
 //               eventually delete when you are done reading).
 //               Returns NULL on failure.  This may only be called
-//               once for a particular HTTPDocument.
+//               once for a particular HTTPChannel.
 ////////////////////////////////////////////////////////////////////
-istream *HTTPDocument::
+istream *HTTPChannel::
 open_read_file() const {
-  return ((HTTPDocument *)this)->read_body();
+  return ((HTTPChannel *)this)->read_body();
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_header_value
+//     Function: HTTPChannel::get_header_value
 //       Access: Published
 //  Description: Returns the HTML header value associated with the
 //               indicated key, or empty string if the key was not
 //               defined in the message returned by the server.
 ////////////////////////////////////////////////////////////////////
-string HTTPDocument::
+string HTTPChannel::
 get_header_value(const string &key) const {
   Headers::const_iterator hi = _headers.find(downcase(key));
   if (hi != _headers.end()) {
@@ -271,12 +271,12 @@ get_header_value(const string &key) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::write_headers
+//     Function: HTTPChannel::write_headers
 //       Access: Published
 //  Description: Outputs a list of all headers defined by the server
 //               to the indicated output stream.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 write_headers(ostream &out) const {
   Headers::const_iterator hi;
   for (hi = _headers.begin(); hi != _headers.end(); ++hi) {
@@ -285,12 +285,12 @@ write_headers(ostream &out) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::read_body
+//     Function: HTTPChannel::read_body
 //       Access: Published
 //  Description: Returns a newly-allocated istream suitable for
 //               reading the body of the document.
 ////////////////////////////////////////////////////////////////////
-ISocketStream *HTTPDocument::
+ISocketStream *HTTPChannel::
 read_body() {
   if (_state != S_read_header) {
     return NULL;
@@ -307,7 +307,7 @@ read_body() {
     _file_size = 0;
     _state = S_started_body;
     _read_index++;
-    result = new IChunkedStream(_source, (HTTPDocument *)this);
+    result = new IChunkedStream(_source, (HTTPChannel *)this);
 
   } else {
     // If the transfer encoding is anything else, assume "identity".
@@ -316,7 +316,7 @@ read_body() {
     // specified), or till end of file otherwise.
     _state = S_started_body;
     _read_index++;
-    result = new IIdentityStream(_source, (HTTPDocument *)this, 
+    result = new IIdentityStream(_source, (HTTPChannel *)this, 
                                  !content_length.empty(), _file_size);
   }
 
@@ -324,7 +324,7 @@ read_body() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::establish_connection
+//     Function: HTTPChannel::establish_connection
 //       Access: Private
 //  Description: Establishes a connection to the server, using the
 //               appropriate means.  Returns true if a connection is
@@ -332,7 +332,7 @@ read_body() {
 //               connection), or false otherwise (and _bio is either
 //               NULL or an invalid connection.)
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 establish_connection() {
   bool result;
   if (_proxy.empty()) {
@@ -353,12 +353,12 @@ establish_connection() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::establish_http
+//     Function: HTTPChannel::establish_http
 //       Access: Private
 //  Description: Establishes a connection to the server directly,
 //               without using a proxy.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 establish_http() {
   _bio = new BioPtr(_url);
   _source = new BioStreamPtr(new IBioStream(_bio));
@@ -366,12 +366,12 @@ establish_http() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::establish_https
+//     Function: HTTPChannel::establish_https
 //       Access: Private
 //  Description: Establishes a connection to the secure server
 //               directly, without using a proxy.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 establish_https() {
   _bio = new BioPtr(_url);
   _source = new BioStreamPtr(new IBioStream(_bio));
@@ -383,12 +383,12 @@ establish_https() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::establish_http_proxy
+//     Function: HTTPChannel::establish_http_proxy
 //       Access: Private
 //  Description: Establishes a connection to the server through a
 //               proxy.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 establish_http_proxy() {
   _bio = new BioPtr(_proxy);
   _source = new BioStreamPtr(new IBioStream(_bio));
@@ -396,12 +396,12 @@ establish_http_proxy() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::establish_https_proxy
+//     Function: HTTPChannel::establish_https_proxy
 //       Access: Private
 //  Description: Establishes a connection to the secure server through
 //               a proxy.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 establish_https_proxy() {
   // First, ask the proxy to open a connection for us.
   _bio = new BioPtr(_proxy);
@@ -485,13 +485,13 @@ establish_https_proxy() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::make_https_connection
+//     Function: HTTPChannel::make_https_connection
 //       Access: Private
 //  Description: Starts speaking SSL over the opened connection.
 //               Returns true on success, false if the SSL connection
 //               cannot be established for some reason.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 make_https_connection() {
   BIO *sbio = BIO_new_ssl(_client->_ssl_ctx, true);
   BIO_push(sbio, *_bio);
@@ -767,14 +767,14 @@ certificate signing
 
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::verify_server
+//     Function: HTTPChannel::verify_server
 //       Access: Private
 //  Description: Returns true if the indicated server matches one of
 //               our expected servers (or the list of expected servers
 //               is empty), or false if it does not match any of our
 //               expected servers.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 verify_server(X509_NAME *subject) const {
   if (_client->_expected_servers.empty()) {
     if (downloader_cat.is_debug()) {
@@ -824,12 +824,12 @@ verify_server(X509_NAME *subject) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_x509_name_component
+//     Function: HTTPChannel::get_x509_name_component
 //       Access: Private, Static
 //  Description: Returns the indicated component of the X509 name as a
 //               string, if defined, or empty string if it is not.
 ////////////////////////////////////////////////////////////////////
-string HTTPDocument::
+string HTTPChannel::
 get_x509_name_component(X509_NAME *name, int nid) {
   ASN1_OBJECT *obj = OBJ_nid2obj(nid);
 
@@ -848,13 +848,13 @@ get_x509_name_component(X509_NAME *name, int nid) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::x509_name_subset
+//     Function: HTTPChannel::x509_name_subset
 //       Access: Private, Static
 //  Description: Returns true if name_a is a subset of name_b: each
 //               property of name_a is defined in name_b, and the
 //               defined value is equivalent to that of name_a.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 x509_name_subset(X509_NAME *name_a, X509_NAME *name_b) {
   int count_a = X509_NAME_entry_count(name_a);
   for (int ai = 0; ai < count_a; ai++) {
@@ -877,13 +877,13 @@ x509_name_subset(X509_NAME *name_a, X509_NAME *name_b) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::make_header
+//     Function: HTTPChannel::make_header
 //       Access: Private
 //  Description: Formats the appropriate GET or POST (or whatever)
 //               request to send to the server.  Also saves the
 //               indicated url.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 make_header(string &header, const string &method, 
             const URLSpec &url, const string &body) {
   set_url(url);
@@ -922,13 +922,13 @@ make_header(string &header, const string &method,
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::set_url
+//     Function: HTTPChannel::set_url
 //       Access: Private
 //  Description: Specifies the document's URL before attempting a
 //               connection.  This controls the name of the server to
 //               be contacted, etc.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 set_url(const URLSpec &url) {
   // If we change between http and https, we have to reset the
   // connection regardless of proxy.  Otherwise, we have to drop the
@@ -944,12 +944,12 @@ set_url(const URLSpec &url) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::issue_request
+//     Function: HTTPChannel::issue_request
 //       Access: Private
 //  Description: Issues the request to the HTTP server and waits for a
 //               response.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 issue_request(const string &header, const string &body) {
   if (!_bio.is_null()) {
     string request = header;
@@ -983,13 +983,13 @@ issue_request(const string &header, const string &body) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::read_http_response
+//     Function: HTTPChannel::read_http_response
 //       Access: Private
 //  Description: Reads all of the responses from the server up until
 //               the first blank line, and stores the list of header
 //               key:value pairs so retrieved.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 read_http_response() {
   _headers.clear();
   _realm = string();
@@ -1112,13 +1112,13 @@ read_http_response() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::store_header_field
+//     Function: HTTPChannel::store_header_field
 //       Access: Private
 //  Description: Stores a single name: value pair in the header list,
 //               or appends the value to the end of the existing
 //               value, if the header has been repeated.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 store_header_field(const string &field_name, const string &field_value) {
   pair<Headers::iterator, bool> insert_result =
     _headers.insert(Headers::value_type(field_name, field_value));
@@ -1133,14 +1133,14 @@ store_header_field(const string &field_name, const string &field_value) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_authorization
+//     Function: HTTPChannel::get_authorization
 //       Access: Private
 //  Description: Looks for a username:password to satisfy the given
 //               authenticate_request string from the server or proxy.
 //               If found, fills in authorization and returns true;
 //               otherwise, returns false.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 get_authorization(string &authorization, const string &authenticate_request,
                   const URLSpec &url, bool is_proxy) {
   AuthenticationSchemes schemes;
@@ -1162,12 +1162,12 @@ get_authorization(string &authorization, const string &authenticate_request,
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::downcase
+//     Function: HTTPChannel::downcase
 //       Access: Private, Static
 //  Description: Returns the input string with all uppercase letters
 //               converted to lowercase.
 ////////////////////////////////////////////////////////////////////
-string HTTPDocument::
+string HTTPChannel::
 downcase(const string &s) {
   string result;
   result.reserve(s.size());
@@ -1179,12 +1179,12 @@ downcase(const string &s) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::base64_encode
+//     Function: HTTPChannel::base64_encode
 //       Access: Private, Static
 //  Description: Returns the input string encoded using base64.  No
 //               respect is paid to maintaining a 76-char line length.
 ////////////////////////////////////////////////////////////////////
-string HTTPDocument::
+string HTTPChannel::
 base64_encode(const string &s) {
   // Collect the string 3 bytes at a time into 24-bit words, then
   // output each word using 4 bytes.
@@ -1227,7 +1227,7 @@ base64_encode(const string &s) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::scan_quoted_or_unquoted_string
+//     Function: HTTPChannel::scan_quoted_or_unquoted_string
 //       Access: Private, Static
 //  Description: Scans the string source beginning at character
 //               position start, to identify either the
@@ -1237,7 +1237,7 @@ base64_encode(const string &s) {
 //               next character position after the string (or after
 //               its closing quote mark).
 ////////////////////////////////////////////////////////////////////
-size_t HTTPDocument::
+size_t HTTPChannel::
 scan_quoted_or_unquoted_string(string &result, const string &source, 
                                size_t start) {
   result = string();
@@ -1281,12 +1281,12 @@ scan_quoted_or_unquoted_string(string &result, const string &source,
 
 #ifndef NDEBUG
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::show_send
+//     Function: HTTPChannel::show_send
 //       Access: Private, Static
 //  Description: Writes the outgoing message, one line at a time, to
 //               the debugging log.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 show_send(const string &message) {
   size_t start = 0;
   size_t newline = message.find('\n', start);
@@ -1305,13 +1305,13 @@ show_send(const string &message) {
 #endif   // NDEBUG
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::parse_authentication_schemes
+//     Function: HTTPChannel::parse_authentication_schemes
 //       Access: Private, Static
 //  Description: Decodes the text following a WWW-Authenticate: or
 //               Proxy-Authenticate: header field.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
-parse_authentication_schemes(HTTPDocument::AuthenticationSchemes &schemes,
+void HTTPChannel::
+parse_authentication_schemes(HTTPChannel::AuthenticationSchemes &schemes,
                              const string &field_value) {
   // This string will consist of one or more records of the form:
   //
@@ -1367,7 +1367,7 @@ parse_authentication_schemes(HTTPDocument::AuthenticationSchemes &schemes,
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::prepare_for_next
+//     Function: HTTPChannel::prepare_for_next
 //       Access: Private
 //  Description: Resets the state to prepare it for sending a new
 //               request to the server.  This might mean closing the
@@ -1382,7 +1382,7 @@ parse_authentication_schemes(HTTPDocument::AuthenticationSchemes &schemes,
 //               this function will fail (and return false) if
 //               multiple connections are required.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
+bool HTTPChannel::
 prepare_for_next(bool allow_reconnect) {
   if (get_persistent_connection() && !will_close_connection() &&
       _proxy == _client->get_proxy()) {
@@ -1462,13 +1462,13 @@ prepare_for_next(bool allow_reconnect) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::free_bio
+//     Function: HTTPChannel::free_bio
 //       Access: Private
 //  Description: Frees the BIO and its IBioStream object, if
 //               allocated.  This will close the connection if it is
 //               open.
 ////////////////////////////////////////////////////////////////////
-void HTTPDocument::
+void HTTPChannel::
 free_bio() {
   _source.clear();
   _bio.clear();
@@ -1477,14 +1477,14 @@ free_bio() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: HTTPDocument::get_basic_authorization
+//     Function: HTTPChannel::get_basic_authorization
 //       Access: Private
 //  Description: Looks for a username:password to satisfy the "Basic"
 //               scheme authorization request from the server or
 //               proxy.
 ////////////////////////////////////////////////////////////////////
-bool HTTPDocument::
-get_basic_authorization(string &authorization, const HTTPDocument::Tokens &tokens, const URLSpec &url, bool is_proxy) {
+bool HTTPChannel::
+get_basic_authorization(string &authorization, const HTTPChannel::Tokens &tokens, const URLSpec &url, bool is_proxy) {
   Tokens::const_iterator ti;
   ti = tokens.find("realm");
   if (ti != tokens.end()) {

+ 21 - 10
panda/src/downloader/httpDocument.h → panda/src/downloader/httpChannel.h

@@ -1,4 +1,4 @@
-// Filename: httpDocument.h
+// Filename: httpChannel.h
 // Created by:  drose (24Sep02)
 //
 ////////////////////////////////////////////////////////////////////
@@ -16,8 +16,8 @@
 //
 ////////////////////////////////////////////////////////////////////
 
-#ifndef HTTPDOCUMENT_H
-#define HTTPDOCUMENT_H
+#ifndef HTTPCHANNEL_H
+#define HTTPCHANNEL_H
 
 #include "pandabase.h"
 
@@ -40,12 +40,23 @@
 class HTTPClient;
 
 ////////////////////////////////////////////////////////////////////
-//       Class : HTTPDocument
-// Description : A single document retrieved from an HTTP server.
+//       Class : HTTPChannel
+// Description : A single channel of communication from an HTTPClient.
+//               This is similar to the concept of a 'connection',
+//               except that HTTP is technically connectionless; in
+//               fact, a channel may represent one unbroken connection
+//               or it may transparently close and reopen a new
+//               connection with each request.
+//
+//               A channel is conceptually a single thread of I/O.
+//               One document at a time may be requested using a
+//               channel; a new document may (in general) not be
+//               requested from the same HTTPChannel until the first
+//               document has been fully retrieved.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDAEXPRESS HTTPDocument : public VirtualFile {
+class EXPCL_PANDAEXPRESS HTTPChannel : public VirtualFile {
 private:
-  HTTPDocument(HTTPClient *client);
+  HTTPChannel(HTTPClient *client);
 
   bool send_request(const string &method, const URLSpec &url, 
                     const string &body);
@@ -53,7 +64,7 @@ private:
                     bool allow_reconnect);
 
 public:
-  virtual ~HTTPDocument();
+  virtual ~HTTPChannel();
 
   virtual VirtualFileSystem *get_file_system() const;
   virtual Filename get_filename() const;
@@ -169,7 +180,7 @@ public:
   }
   static void init_type() {
     VirtualFile::init_type();
-    register_type(_type_handle, "HTTPDocument",
+    register_type(_type_handle, "HTTPChannel",
                   VirtualFile::get_class_type());
   }
 
@@ -180,7 +191,7 @@ private:
   friend class HTTPClient;
 };
 
-#include "httpDocument.I"
+#include "httpChannel.I"
 
 #endif  // HAVE_SSL
 

+ 12 - 12
panda/src/downloader/httpClient.cxx

@@ -17,7 +17,7 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "httpClient.h"
-#include "httpDocument.h"
+#include "httpChannel.h"
 #include "config_downloader.h"
 #include "filename.h"
 #include "config_express.h"
@@ -288,15 +288,15 @@ clear_expected_servers() {
 ////////////////////////////////////////////////////////////////////
 //     Function: HTTPClient::make_channel
 //       Access: Published
-//  Description: Returns a new HTTPDocument object that may be used
+//  Description: Returns a new HTTPChannel object that may be used
 //               for reading multiple documents using the same
 //               connection, for greater network efficiency than
 //               calling HTTPClient::get_document() repeatedly (and
 //               thus forcing a new connection for each document).
 ////////////////////////////////////////////////////////////////////
-PT(HTTPDocument) HTTPClient::
+PT(HTTPChannel) HTTPClient::
 make_channel() {
-  PT(HTTPDocument) doc = new HTTPDocument(this);
+  PT(HTTPChannel) doc = new HTTPChannel(this);
   doc->set_persistent_connection(true);
   return doc;
 }
@@ -305,14 +305,14 @@ make_channel() {
 //     Function: HTTPClient::post_form
 //       Access: Published
 //  Description: Posts form data to a particular URL and retrieves the
-//               response.  Returns a new HTTPDocument object whether
+//               response.  Returns a new HTTPChannel object whether
 //               the document is successfully read or not; you can
 //               test is_valid() and get_return_code() to determine
 //               whether the document was retrieved.
 ////////////////////////////////////////////////////////////////////
-PT(HTTPDocument) HTTPClient::
+PT(HTTPChannel) HTTPClient::
 post_form(const URLSpec &url, const string &body) {
-  PT(HTTPDocument) doc = new HTTPDocument(this);
+  PT(HTTPChannel) doc = new HTTPChannel(this);
   doc->post_form(url, body);
   return doc;
 }
@@ -322,14 +322,14 @@ post_form(const URLSpec &url, const string &body) {
 //       Access: Published
 //  Description: Opens the named document for reading, or if body is
 //               nonempty, posts data for a particular URL and
-//               retrieves the response.  Returns a new HTTPDocument
+//               retrieves the response.  Returns a new HTTPChannel
 //               object whether the document is successfully read or
 //               not; you can test is_valid() and get_return_code() to
 //               determine whether the document was retrieved.
 ////////////////////////////////////////////////////////////////////
-PT(HTTPDocument) HTTPClient::
+PT(HTTPChannel) HTTPClient::
 get_document(const URLSpec &url, const string &body) {
-  PT(HTTPDocument) doc = new HTTPDocument(this);
+  PT(HTTPChannel) doc = new HTTPChannel(this);
   if (body.empty()) {
     doc->get_document(url);
   } else {
@@ -347,9 +347,9 @@ get_document(const URLSpec &url, const string &body) {
 //               might also return the size of the document (if the
 //               server gives us this information).
 ////////////////////////////////////////////////////////////////////
-PT(HTTPDocument) HTTPClient::
+PT(HTTPChannel) HTTPClient::
 get_header(const URLSpec &url) {
-  PT(HTTPDocument) doc = new HTTPDocument(this);
+  PT(HTTPChannel) doc = new HTTPChannel(this);
   doc->get_header(url);
   return doc;
 }

+ 6 - 6
panda/src/downloader/httpClient.h

@@ -39,7 +39,7 @@
 #endif
 
 class Filename;
-class HTTPDocument;
+class HTTPChannel;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : HTTPClient
@@ -89,11 +89,11 @@ PUBLISHED:
   bool add_expected_server(const string &server_attributes);
   void clear_expected_servers();
 
-  PT(HTTPDocument) make_channel();
-  PT(HTTPDocument) post_form(const URLSpec &url, const string &body);
-  PT(HTTPDocument) get_document(const URLSpec &url,
+  PT(HTTPChannel) make_channel();
+  PT(HTTPChannel) post_form(const URLSpec &url, const string &body);
+  PT(HTTPChannel) get_document(const URLSpec &url,
                                 const string &body = string());
-  PT(HTTPDocument) get_header(const URLSpec &url);
+  PT(HTTPChannel) get_header(const URLSpec &url);
 
 private:
   void make_ctx();
@@ -125,7 +125,7 @@ private:
 
   static bool _ssl_initialized;
   static X509_STORE *_x509_store;
-  friend class HTTPDocument;
+  friend class HTTPChannel;
 };
 
 #include "httpClient.I"

+ 2 - 2
panda/src/downloader/identityStream.I

@@ -32,7 +32,7 @@ IIdentityStream() : ISocketStream(&_buf) {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE IIdentityStream::
-IIdentityStream(BioStreamPtr *source, HTTPDocument *doc,
+IIdentityStream(BioStreamPtr *source, HTTPChannel *doc,
                 bool has_content_length, size_t content_length) : 
   ISocketStream(&_buf) 
 {
@@ -45,7 +45,7 @@ IIdentityStream(BioStreamPtr *source, HTTPDocument *doc,
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 INLINE IIdentityStream &IIdentityStream::
-open(BioStreamPtr *source, HTTPDocument *doc, 
+open(BioStreamPtr *source, HTTPChannel *doc, 
      bool has_content_length, size_t content_length) {
   clear(0);
   _buf.open_read(source, doc, has_content_length, content_length);

+ 4 - 4
panda/src/downloader/identityStream.h

@@ -27,7 +27,7 @@
 #include "socketStream.h"
 #include "identityStreamBuf.h"
 
-class HTTPDocument;
+class HTTPChannel;
 class BioStreamPtr;
 
 ////////////////////////////////////////////////////////////////////
@@ -40,17 +40,17 @@ class BioStreamPtr;
 //               stream (like a SubStreamBuf) up to but not past the
 //               specified content-length.  (If the content-length was
 //               unspecified, this class cannot be used.)  It also
-//               updates the HTTPDocument when the stream is
+//               updates the HTTPChannel when the stream is
 //               completely read.
 ////////////////////////////////////////////////////////////////////
 // No need to export from DLL.
 class IIdentityStream : public ISocketStream {
 public:
   INLINE IIdentityStream();
-  INLINE IIdentityStream(BioStreamPtr *source, HTTPDocument *doc,
+  INLINE IIdentityStream(BioStreamPtr *source, HTTPChannel *doc,
                          bool has_content_length, size_t content_length);
 
-  INLINE IIdentityStream &open(BioStreamPtr *source, HTTPDocument *doc,
+  INLINE IIdentityStream &open(BioStreamPtr *source, HTTPChannel *doc,
                                bool has_content_length, size_t content_length);
   INLINE IIdentityStream &close();
 

+ 6 - 6
panda/src/downloader/identityStreamBuf.cxx

@@ -70,14 +70,14 @@ IdentityStreamBuf::
 //               from the identity encoding.
 ////////////////////////////////////////////////////////////////////
 void IdentityStreamBuf::
-open_read(BioStreamPtr *source, HTTPDocument *doc, 
+open_read(BioStreamPtr *source, HTTPChannel *doc, 
           bool has_content_length, size_t content_length) {
   _source = source;
   _doc = doc;
   _has_content_length = has_content_length;
   _bytes_remaining = content_length;
 
-  if (_doc != (HTTPDocument *)NULL) {
+  if (_doc != (HTTPChannel *)NULL) {
     _read_index = doc->_read_index;
   }
 }
@@ -141,10 +141,10 @@ read_chars(char *start, size_t length) {
 
     if (length == 0) {
       // End of file; we're done.
-      if (_doc != (HTTPDocument *)NULL && _read_index == _doc->_read_index) {
+      if (_doc != (HTTPChannel *)NULL && _read_index == _doc->_read_index) {
         // An IdentityStreamBuf doesn't have a trailer, so we've already
         // "read" it.
-        _doc->_state = HTTPDocument::S_read_trailer;
+        _doc->_state = HTTPChannel::S_read_trailer;
       }
     }
 
@@ -162,10 +162,10 @@ read_chars(char *start, size_t length) {
     
     if (_bytes_remaining == 0) {
       // We're done.
-      if (_doc != (HTTPDocument *)NULL && _read_index == _doc->_read_index) {
+      if (_doc != (HTTPChannel *)NULL && _read_index == _doc->_read_index) {
         // An IdentityStreamBuf doesn't have a trailer, so we've already
         // "read" it.
-        _doc->_state = HTTPDocument::S_read_trailer;
+        _doc->_state = HTTPChannel::S_read_trailer;
       }
     }
   }

+ 3 - 3
panda/src/downloader/identityStreamBuf.h

@@ -24,7 +24,7 @@
 // This module is not compiled if OpenSSL is not available.
 #ifdef HAVE_SSL
 
-#include "httpDocument.h"
+#include "httpChannel.h"
 #include "bioStreamPtr.h"
 #include "pointerTo.h"
 
@@ -38,7 +38,7 @@ public:
   IdentityStreamBuf();
   virtual ~IdentityStreamBuf();
 
-  void open_read(BioStreamPtr *source, HTTPDocument *doc,
+  void open_read(BioStreamPtr *source, HTTPChannel *doc,
                  bool has_content_length, size_t content_length);
   void close_read();
 
@@ -52,7 +52,7 @@ private:
   bool _has_content_length;
   size_t _bytes_remaining;
 
-  PT(HTTPDocument) _doc;
+  PT(HTTPChannel) _doc;
   int _read_index;
 
   friend class IIdentityStream;