Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

sword::HttpClient Class Reference

An Http client. More...

Inheritance diagram for sword::HttpClient:

sword::IStorage

Public Types

typedef std::map< std::string,
std::string > 
Arguments
enum  Code { Success, AuthRequired, FileNotFound, Error }
enum  PostMethod { Get, Post }

Public Methods

 HttpClient (const URL &url, HttpSession &session)
void addHeader (const std::string &line)
 Add an http header line to the request.

Code fetch ()
 Sends the request and fetch the document.

Code fetch (const Arguments &arguments, PostMethod method)
 Sends the request and fetch the document.

std::string replyValue (const std::string &name) const
 Obtain a reply value.

word size () const
 Obtain the size of the document, or '0' if it could not be computed.

word read (void *buffer, word length)
 Read data from the document (implements IStorage).


Detailed Description

An Http client.


Member Function Documentation

void sword::HttpClient::addHeader const std::string &    line
 

Add an http header line to the request.

The line must not include the end-of-line "
" (endl) character

Code sword::HttpClient::fetch const Arguments &    arguments,
PostMethod    method
 

Sends the request and fetch the document.

Code sword::HttpClient::fetch  
 

Sends the request and fetch the document.

word sword::HttpClient::read void *    buffer,
word    length
 

Read data from the document (implements IStorage).

Reimplemented from sword::IStorage.

std::string sword::HttpClient::replyValue const std::string &    name const
 

Obtain a reply value.

All reply value names are set to all lower case while fetching the page. So all access to this method must use only lower case names. If the value is not available, an empty string is returned.

word sword::HttpClient::size   const
 

Obtain the size of the document, or '0' if it could not be computed.

Some web pages are returned as a fixed-size blob (and their size were available in the request answer header, but some web pages are returned more as "streams" (chunked for instance), and their size cannot be predicted.


Generated on Tue Dec 23 20:08:57 2003 for SWORD by doxygen1.3-rc2