web::http_request Class Reference
[Web client/server base classes]

#include <webclient.hh>

List of all members.

Public Types

typedef std::map< std::string,
std::string, header_sort
header_type
 header type (name/token)

Public Member Functions

 http_request ()
 http_request (const char *url, const char *addr, int port=80)
 ~http_request ()
bool open (const char *addr, int port=80)
void close ()
bool request (const char *url)
 send request and wait for answer
bool request (const char *url, const char *addr, int port=80)
const header_typeheader () const
 Get header.
int size () const
 Get content length.
char * data ()
 Get content pointer.

Static Public Member Functions

static std::string mangle (const std::string &s)
static std::string demangle (const std::string &s)

Protected Member Functions

bool sendRequest (const char *url)
 send an http request
bool recvHeader ()
 receive the header of the response
bool recvContent ()
 receive the content
bool uncompress ()
 uncompress the content

Protected Attributes

header_type fHeader
 header
char * fData
 Data.
int fLen
 Data length.
int fFill
 filled data
int fSock
 Socket.

Classes

class  header_sort
 Header sort order. More...


Detailed Description

Class to access a web server.

brief web server access class

Author:
Written February 2005 by Daniel Sigg
Version:
1.0

Constructor & Destructor Documentation

web::http_request::http_request (  ) 

Default constructor. brief Default constructor

web::http_request::http_request ( const char *  url,
const char *  addr,
int  port = 80 
)

Constructor. Open connection, send request and wait for answer. brief Open connection, send request and wait for answer

Parameters:
url URL string
addr Web server address
port Web server port number
Returns:
true if successful

web::http_request::~http_request (  ) 

Destructor. brief Destructor


Member Function Documentation

bool web::http_request::open ( const char *  addr,
int  port = 80 
)

Open connection. brief Open connection

Parameters:
addr Web server address
port Web server port number
Returns:
true if successful

void web::http_request::close (  ) 

Close connection. brief Close connection

bool web::http_request::request ( const char *  url  ) 

send request and wait for answer

Send request and wait for answer. brief Send request and wait for answer

Parameters:
url URL string
Returns:
true if successful

bool web::http_request::request ( const char *  url,
const char *  addr,
int  port = 80 
)

Open connection, send request and wait for answer. brief Open connection, send request and wait for answer

Parameters:
url URL string
addr Web server address
port Web server port number
Returns:
true if successful

static std::string web::http_request::mangle ( const std::string &  s  )  [static]

Mangle a string to escape control characters. brief Mangle

Parameters:
s input string
Returns:
mangled string

static std::string web::http_request::demangle ( const std::string &  s  )  [static]

Demangle a string to unescape control characters. brief Demangle

Parameters:
s input string
Returns:
demangled string


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:37 2009 for dmt by  doxygen 1.5.4