Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

WvHTTPStream Class Reference

#include <wvhttp.h>

Inheritance diagram for WvHTTPStream:

WvStreamClone WvStreamClone WvStream WvStream WvStream WvStream List of all members.

Public Types

enum  State {
  Resolving = 0, Connecting, ReadHeader1, ReadHeader,
  ReadData, Done
}
enum  State {
  Resolving = 0, Connecting, ReadHeader1, ReadHeader,
  ReadData, Done
}

Public Methods

 WvHTTPStream (WvURL &_url)
 ~WvHTTPStream ()
virtual bool isok () const
virtual int geterr () const
virtual const char * errstr () const
virtual bool pre_select (SelectInfo &si)
virtual size_t uread (void *buf, size_t count)
 WvHTTPStream (WvURL &_url)
 ~WvHTTPStream ()
virtual bool isok () const
virtual int geterr () const
virtual const char * errstr () const
virtual bool pre_select (SelectInfo &si)
virtual size_t uread (void *buf, size_t count)

Public Attributes

WvHTTPHeaderDict headers
WvHTTPHeaderDict client_headers
size_t num_received
WvURLurl
WvTCPConnhttp
State state
WvURLurl
WvTCPConnhttp

Detailed Description

WvHTTPStream connects to an HTTP server and allows the requested file to be retrieved using the usual WvStream-style calls.

Definition at line 59 of file include/wvhttp.h.


Member Enumeration Documentation

enum WvHTTPStream::State
 

Enumeration values:
Resolving 
Connecting 
ReadHeader1 
ReadHeader 
ReadData 
Done 

Definition at line 62 of file ipstreams/wvhttp.h.

enum WvHTTPStream::State
 

Enumeration values:
Resolving 
Connecting 
ReadHeader1 
ReadHeader 
ReadData 
Done 

Definition at line 62 of file include/wvhttp.h.


Constructor & Destructor Documentation

WvHTTPStream::WvHTTPStream WvURL   _url
 

do not delete '_url' before you delete this stream!

Definition at line 122 of file wvhttp.cc.

References http, num_received, WvURL::resolve(), Resolving, state, and url.

WvHTTPStream::~WvHTTPStream  
 

Definition at line 136 of file wvhttp.cc.

References http.

WvHTTPStream::WvHTTPStream WvURL   _url
 

do not delete '_url' before you delete this stream!

WvHTTPStream::~WvHTTPStream  
 


Member Function Documentation

virtual const char* WvHTTPStream::errstr   const [virtual]
 

Reimplemented from WvStreamClone.

const char * WvHTTPStream::errstr   const [virtual]
 

Reimplemented from WvStreamClone.

Definition at line 160 of file wvhttp.cc.

References WvURL::errstr(), WvStreamClone::errstr(), WvURL::isok(), and url.

virtual int WvHTTPStream::geterr   const [virtual]
 

if isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file. If isok() is true, returns an undefined number.

Reimplemented from WvStreamClone.

int WvHTTPStream::geterr   const [virtual]
 

if isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file. If isok() is true, returns an undefined number.

Reimplemented from WvStreamClone.

Definition at line 151 of file wvhttp.cc.

References WvStreamClone::geterr().

virtual bool WvHTTPStream::isok   const [virtual]
 

return true if the stream is actually usable right now

Reimplemented from WvStreamClone.

bool WvHTTPStream::isok   const [virtual]
 

return true if the stream is actually usable right now

Reimplemented from WvStreamClone.

Definition at line 142 of file wvhttp.cc.

References WvURL::isok(), WvStreamClone::isok(), and url.

Referenced by pre_select().

virtual bool WvHTTPStream::pre_select SelectInfo &    si [virtual]
 

pre_select() sets up for eventually calling select(). It adds the right fds to the read, write, and except lists in the SelectInfo struct.

Returns true if we already know this stream is ready, and there's no need to actually do a real select(). Some streams, such as timers, can be implemented by _only_ either returning true or false here after doing a calculation, and never actually adding anything to the SelectInfo.

You can add your stream to any of the lists even if readable, writable, or isexception isn't set. This is what force_select() does. You can also choose not to add yourself to the list if you know it would be useless right now.

pre_select() is only called if isok() is true.

pre_select() is allowed to reduce msec_timeout (or change it if it's -1). However, it's not allowed to _increase_ msec_timeout.

Reimplemented from WvStreamClone.

bool WvHTTPStream::pre_select SelectInfo &    si [virtual]
 

pre_select() sets up for eventually calling select(). It adds the right fds to the read, write, and except lists in the SelectInfo struct.

Returns true if we already know this stream is ready, and there's no need to actually do a real select(). Some streams, such as timers, can be implemented by _only_ either returning true or false here after doing a calculation, and never actually adding anything to the SelectInfo.

You can add your stream to any of the lists even if readable, writable, or isexception isn't set. This is what force_select() does. You can also choose not to add yourself to the list if you know it would be useless right now.

pre_select() is only called if isok() is true.

pre_select() is allowed to reduce msec_timeout (or change it if it's -1). However, it's not allowed to _increase_ msec_timeout.

Reimplemented from WvStreamClone.

Definition at line 171 of file wvhttp.cc.

References client_headers, Connecting, WvURL::getaddr(), WvStream::geterr(), WvURL::getfile(), http, WvTCPConn::isconnected(), WvStreamClone::isok(), WvURL::isok(), isok(), WvStreamClone::pre_select(), WvStream::print(), ReadHeader1, WvURL::resolve(), Resolving, WvStream::select(), WvStream::seterr(), state, and url.

virtual size_t WvHTTPStream::uread void *    buf,
size_t    count
[virtual]
 

unbuffered I/O functions; these ignore the buffer, which is handled by read(). Don't call these functions unless you have a _really_ good reason.

Reimplemented from WvStreamClone.

size_t WvHTTPStream::uread void *    buf,
size_t    count
[virtual]
 

unbuffered I/O functions; these ignore the buffer, which is handled by read(). Don't call these functions unless you have a _really_ good reason.

Reimplemented from WvStreamClone.

Definition at line 215 of file wvhttp.cc.

References WvHTTPHeaderDict::add(), Connecting, Done, WvStream::getline(), headers, http, num_received, WvStream::read(), ReadData, ReadHeader, ReadHeader1, Resolving, WvStream::seterr(), state, and trim_string().


Member Data Documentation

WvHTTPHeaderDict WvHTTPStream::client_headers
 

Definition at line 65 of file ipstreams/wvhttp.h.

Referenced by pre_select().

WvHTTPHeaderDict WvHTTPStream::headers
 

Definition at line 64 of file ipstreams/wvhttp.h.

Referenced by uread().

WvTCPConn* WvHTTPStream::http
 

Definition at line 82 of file ipstreams/wvhttp.h.

WvTCPConn* WvHTTPStream::http
 

Definition at line 82 of file include/wvhttp.h.

Referenced by pre_select(), uread(), WvHTTPStream(), and ~WvHTTPStream().

size_t WvHTTPStream::num_received
 

Definition at line 66 of file ipstreams/wvhttp.h.

Referenced by uread(), and WvHTTPStream().

State WvHTTPStream::state
 

Definition at line 83 of file ipstreams/wvhttp.h.

Referenced by pre_select(), uread(), and WvHTTPStream().

WvURL& WvHTTPStream::url
 

Definition at line 81 of file ipstreams/wvhttp.h.

WvURL& WvHTTPStream::url
 

Definition at line 81 of file include/wvhttp.h.

Referenced by errstr(), isok(), pre_select(), and WvHTTPStream().


The documentation for this class was generated from the following files:
Generated on Sun Aug 25 12:42:47 2002 for WvStreams by doxygen1.2.15