Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

ost::URLStream Class Reference

A URL processing version of TCPStream. C++ url processing stream class. More...

#include <url.h>

Inheritance diagram for ost::URLStream:

ost::TCPStream ost::Socket List of all members.

Public Types

enum  Error {
  errSuccess = 0, errUnreachable, errMissing, errDenied,
  errInvalid, errForbidden, errUnauthorized, errRelocated,
  errFailure, errTimeout
}
 Return error for url fetch. More...

enum  Authentication { authAnonymous = 0, authBasic }
 Type of authentication. More...

enum  Encoding { encodingBinary = 0, encodingChunked }
 Encoding used in transfer. More...

enum  Method {
  methodHttpGet, methodHttpPut, methodHttpPost, methodFtpGet,
  methodFtpPut, methodFileGet, methodFilePut
}
 Type of fetch. More...

enum  Protocol { protocolHttp1_0, protocolHttp1_1 }
 http protocol version More...


Public Methods

 URLStream (timeout_t to=0)
 Construct an instance of URL stream.

URLStream & getline (char *buffer, size_t len)
 Line parsing with conversion.

Error get (const char *url, int buffer=512)
 Get URL data from a named stream of a known buffer size.

Error submit (const char *url, const char **vars, int buffer=512)
 Submit URL with vars passed as argument array.

Error post (const char *url, const char **vars, int buffer=512)
 Post URL vars with post method.

Error head (const char *url, int buffer=512)
 Used to fetch header information for a resource.

void close ()
 Close the URL stream for a new connection.

void setReferer (const char *str)
 Set the referer url.

void setCookie (const char *str)
 Set the cookie to pass.

void setUser (const char *str)
 Set user id for the url.

void setPassword (const char *str)
 Set password for the url.

void setAuthentication (Authentication a, const char *str=NULL)
 Set authentication type for the url.

void setPragma (const char *str)
 Set the pragmas.

void setProxy (const char *host, tpport_t port)
 Set the proxy server used.

void setAgent (const char *str)
 Set the agent.

Method getMethod (void)
 Get url method (and protocol) employed.

void setTimeout (timeout_t to)
 Set socket timeout characteristics for processing URL requests.

void setFollow (bool enable)
 Specify url following.

void setProtocol (Protocol pro)
 Specify http protocol level being used.

void setLocalInterface (const char *intf)
 Specify local interface to use.


Protected Methods

Error sendHTTPHeader (const char *url, const char **vars, int bufsize)
int underflow (void)
virtual int aRead (char *buffer, size_t len, timeout_t timeout)
virtual int aWrite (char *buffer, size_t len, timeout_t timeout)
virtual void httpHeader (const char *header, const char *value)
 Derived method to receive and parse http "headers".

virtual char ** extraHeader (void)
 A virtual to insert additional header info into the request.


Detailed Description

A URL processing version of TCPStream. C++ url processing stream class.

Author:
David Sugar <dyfet@ostel.com>


Member Enumeration Documentation

enum ost::URLStream::Authentication
 

Type of authentication.

Enumeration values:
authAnonymous 
authBasic 

enum ost::URLStream::Encoding
 

Encoding used in transfer.

Enumeration values:
encodingBinary 
encodingChunked 

enum ost::URLStream::Error
 

Return error for url fetch.

Enumeration values:
errSuccess 
errUnreachable 
errMissing 
errDenied 
errInvalid 
errForbidden 
errUnauthorized 
errRelocated 
errFailure 
errTimeout 

Reimplemented from ost::Socket.

enum ost::URLStream::Method
 

Type of fetch.

Enumeration values:
methodHttpGet 
methodHttpPut 
methodHttpPost 
methodFtpGet 
methodFtpPut 
methodFileGet 
methodFilePut 

enum ost::URLStream::Protocol
 

http protocol version

Enumeration values:
protocolHttp1_0 
protocolHttp1_1 


Constructor & Destructor Documentation

ost::URLStream::URLStream timeout_t    to = 0
 

Construct an instance of URL stream.

Parameters:
to  default timeout.


Member Function Documentation

virtual int ost::URLStream::aRead char *    buffer,
size_t    len,
timeout_t    timeout
[inline, protected, virtual]
 

virtual int ost::URLStream::aWrite char *    buffer,
size_t    len,
timeout_t    timeout
[inline, protected, virtual]
 

void ost::URLStream::close  
 

Close the URL stream for a new connection.

virtual char** ost::URLStream::extraHeader void    [inline, protected, virtual]
 

A virtual to insert additional header info into the request.

Returns:
array of header attributes to add.

Error ost::URLStream::get const char *    url,
int    buffer = 512
 

Get URL data from a named stream of a known buffer size.

Returns:
url error code.
Parameters:
url  name of resource.
buffer  size of buffer.

URLStream& ost::URLStream::getline char *    buffer,
size_t    len
 

Line parsing with conversion.

Returns:
URLStream object.
Parameters:
buffer  to store.
len  maximum buffer size.

Method ost::URLStream::getMethod void    [inline]
 

Get url method (and protocol) employed.

Returns:
url method in effect.

Error ost::URLStream::head const char *    url,
int    buffer = 512
 

Used to fetch header information for a resource.

Returns:
url error code.
Parameters:
url  name of resource.
buffer  size of buffer.

virtual void ost::URLStream::httpHeader const char *    header,
const char *    value
[inline, protected, virtual]
 

Derived method to receive and parse http "headers".

Parameters:
header  keyword.
value  header keyword value.

Error ost::URLStream::post const char *    url,
const char **    vars,
int    buffer = 512
 

Post URL vars with post method.

Returns:
url error code.
Parameters:
url  name of resource.
vars  to set.
buffer  size of buffer.

Error ost::URLStream::sendHTTPHeader const char *    url,
const char **    vars,
int    bufsize
[protected]
 

void ost::URLStream::setAgent const char *    str [inline]
 

Set the agent.

Parameters:
str  agent value.

void ost::URLStream::setAuthentication Authentication    a,
const char *    str = NULL
 

Set authentication type for the url.

Parameters:
a  authentication.
str  string.

void ost::URLStream::setCookie const char *    str [inline]
 

Set the cookie to pass.

Parameters:
str  cookie string.

void ost::URLStream::setFollow bool    enable [inline]
 

Specify url following.

Set to false to disable following of relocation requests.

Parameters:
enable  true to enable following.

void ost::URLStream::setLocalInterface const char *    intf [inline]
 

Specify local interface to use.

Parameters:
intf  Local interface name

void ost::URLStream::setPassword const char *    str [inline]
 

Set password for the url.

Parameters:
str  password.

void ost::URLStream::setPragma const char *    str [inline]
 

Set the pragmas.

Parameters:
str  pragma setting.

void ost::URLStream::setProtocol Protocol    pro [inline]
 

Specify http protocol level being used.

Parameters:
pro  protocol level.

void ost::URLStream::setProxy const char *    host,
tpport_t    port
 

Set the proxy server used.

Parameters:
host  proxy host.
port  proxy port.

void ost::URLStream::setReferer const char *    str
 

Set the referer url.

Parameters:
str  referer string.

void ost::URLStream::setTimeout timeout_t    to [inline]
 

Set socket timeout characteristics for processing URL requests.

Set to 0 for no default timeouts.

Parameters:
to  timeout to set.

Reimplemented from ost::TCPStream.

void ost::URLStream::setUser const char *    str [inline]
 

Set user id for the url.

Parameters:
str  user id.

Error ost::URLStream::submit const char *    url,
const char **    vars,
int    buffer = 512
 

Submit URL with vars passed as argument array.

This submit assumes "GET" method. Use "post" member to perform post.

Returns:
url error code.
Parameters:
url  name of resource.
vars  to set.
buffer  size of buffer.

int ost::URLStream::underflow void    [protected]
 

Reimplemented from ost::TCPStream.


The documentation for this class was generated from the following file:
Generated on Thu Nov 21 12:28:34 2002 for GNU CommonC++ by doxygen1.2.18