Public Member Functions | Protected Attributes

base_http::HTTPServer Class Reference

A http server. More...

#include <libppbase/base_http/HTTPServer.h>

Inheritance diagram for base_http::HTTPServer:
base_http::HTTPClient

List of all members.

Public Member Functions

 HTTPServer (const char *name=NULL, base::Socket *sock=NULL, const base::String &addr="")
 Constructor.
void clearNonce ()
 Resets the nonce.
base::String createDigestHeader (const char *realm)
 Creates a digest authorization header.
base::String createDigestNonce ()
 Creates a new nonce for digest authorization.
base::String createInfoHeader ()
 Creates an authorization-info header.
const char * getNonce () const
 Returns the nonce.
const char * getServerName () const
 Returns the server name.
HTTPRequestreadHeader ()
 Reads the http header.
HTTPRequestreadRequest ()
 Reads the next http request.
void sendError (const HTTPRequest &request, int code, const char *message, const char *fname=NULL, const char *body=NULL)
 Sends a http error message back to the client.
void sendResponse (HTTPResponse &response)
 Sends a http response to the client.
void setServerName (const char *name)
 Sets the server name.

Protected Attributes

bool _closeconn
 flag: close connection after this request
base::String _name
 server name
base::String _nonce
 last nonce for digest authentication

Detailed Description

A http server.

Author:
Christoph Schwarz
Version:
$Id: HTTPServer.h 21 2010-09-05 04:18:17Z cschwarz1 $

Constructor & Destructor Documentation

base_http::HTTPServer::HTTPServer ( const char *  name = NULL,
base::Socket sock = NULL,
const base::String addr = "" 
)

Constructor.

Parameters:
name server name
sock socket to client
addr client's ip address

Member Function Documentation

base::String base_http::HTTPServer::createDigestHeader ( const char *  realm  ) 

Creates a digest authorization header.

Parameters:
realm the realm
Returns:
the header
base::String base_http::HTTPServer::createDigestNonce (  ) 

Creates a new nonce for digest authorization.

Returns:
the new nonce
base::String base_http::HTTPServer::createInfoHeader (  ) 

Creates an authorization-info header.

Returns:
the header
const char* base_http::HTTPServer::getNonce (  )  const

Returns the nonce.

Returns:
the nonce
const char* base_http::HTTPServer::getServerName (  )  const

Returns the server name.

Returns:
the server name
HTTPRequest* base_http::HTTPServer::readHeader (  ) 

Reads the http header.

Returns:
a new http request, where only the headers have been read, NULL on EOF
HTTPRequest* base_http::HTTPServer::readRequest (  ) 

Reads the next http request.

Returns:
NULL on EOF
void base_http::HTTPServer::sendError ( const HTTPRequest request,
int  code,
const char *  message,
const char *  fname = NULL,
const char *  body = NULL 
)

Sends a http error message back to the client.

Parameters:
request the http request
code the http status code
message the http status message
fname the file name to read the message from
body the message body
void base_http::HTTPServer::sendResponse ( HTTPResponse response  ) 

Sends a http response to the client.

Parameters:
response the response to send
void base_http::HTTPServer::setServerName ( const char *  name  ) 

Sets the server name.

Parameters:
name the server name

The documentation for this class was generated from the following file: