A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

HTTPConnection Class Reference

For every incomming connection we have a HTTPConnection object which will handle the requests of this connection. More...

#include <HTTPServer.h>

Inherits mbed::TCPConnection, mbed::TCPConnection, mbed::TCPConnection, mbed::TCPConnection, and mbed::TCPConnection.

Public Member Functions

 HTTPConnection (HTTPServer *parent, struct tcp_pcb *pcb)
 Constructs a new connection object from a server.
virtual ~HTTPConnection ()
 Default destructor.
char * getURL () const
 Get the requested url.
const char * getHeaderFields () const
 Gets a string of set fields to send with the answere header.
const int & getLength () const
 Gets the length of the anwere in bytes.
const char & getType () const
 Gets POST or GET or 0 depends on wether ther is a request and what type is requested.
const char * getField (char *key) const
 Gets a value from a header field of the request header.
void addField (char *key, char *value)
 For internal usage.
void setLength (const int &value)
 Sets the result length for an request shoud be set in an HTTPHandler.init() call.
void setHeaderFields (char *value)
 Set the response header field to a value.
 HTTPConnection (HTTPServer *parent, struct tcp_pcb *pcb)
 Constructs a new connection object from a server.
virtual ~HTTPConnection ()
 Default destructor.
char * getURL () const
 Get the requested url.
const char * getHeaderFields () const
 Gets a string of set fields to send with the answere header.
const int & getLength () const
 Gets the length of the anwere in bytes.
const char & getType () const
 Gets POST or GET or 0 depends on wether ther is a request and what type is requested.
const char * getField (char *key) const
 Gets a value from a header field of the request header.
void addField (char *key, char *value)
 For internal usage.
void setLength (const int &value)
 Sets the result length for an request shoud be set in an HTTPHandler.init() call.
void setHeaderFields (char *value)
 Set the response header field to a value.
 HTTPConnection (HTTPServer *parent, struct tcp_pcb *pcb)
 Constructs a new connection object from a server.
virtual ~HTTPConnection ()
 Default destructor.
char * getURL () const
 Get the requested url.
const char * getHeaderFields () const
 Gets a string of set fields to send with the answere header.
const int & getLength () const
 Gets the length of the anwere in bytes.
const char & getType () const
 Gets POST or GET or 0 depends on wether ther is a request and what type is requested.
const char * getField (char *key) const
 Gets a value from a header field of the request header.
void addField (char *key, char *value)
 For internal usage.
void setLength (const int &value)
 Sets the result length for an request shoud be set in an HTTPHandler.init() call.
void setHeaderFields (char *value)
 Set the response header field to a value.
 HTTPConnection (HTTPServer *parent, struct tcp_pcb *pcb)
 Constructs a new connection object from a server.
virtual ~HTTPConnection ()
 Default destructor.
char * getURL () const
 Get the requested url.
const char * getHeaderFields () const
 Gets a string of set fields to send with the answere header.
const int & getLength () const
 Gets the length of the anwere in bytes.
const char & getType () const
 Gets POST or GET or 0 depends on wether ther is a request and what type is requested.
const char * getField (char *key) const
 Gets a value from a header field of the request header.
void addField (char *key, char *value)
 For internal usage.
void setLength (const int &value)
 Sets the result length for an request shoud be set in an HTTPHandler.init() call.
void setHeaderFields (char *value)
 Set the response header field to a value.
 HTTPConnection (HTTPServer *parent, struct tcp_pcb *pcb)
 Constructs a new connection object from a server.
virtual ~HTTPConnection ()
 Default destructor.
char * getURL () const
 Get the requested url.
const char * getHeaderFields () const
 Gets a string of set fields to send with the answere header.
const int & getLength () const
 Gets the length of the anwere in bytes.
const char & getType () const
 Gets POST or GET or 0 depends on wether ther is a request and what type is requested.
const char * getField (char *key) const
 Gets a value from a header field of the request header.
void addField (char *key, char *value)
 For internal usage.
void setLength (const int &value)
 Sets the result length for an request shoud be set in an HTTPHandler.init() call.
void setHeaderFields (char *value)
 Set the response header field to a value.
virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.

Data Fields

bool request_incomplete
 Indicates that if a request is received the header is incomplete until now.
HTTPDatadata
 If an request is complete HTTPHandler:init will be called and can store here its connection data.
HTTPHandlerrequest_handler
 The handler which handles the current request.
HTTPStatus request_status
 The status of the request.
HTTPServerparent
 The HTTTPServer which created this connection.

Protected Member Functions

virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.
virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.
virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.
virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.
virtual err_t connected (err_t err)
 Function to be called when a connection has been set up.

Detailed Description

For every incomming connection we have a HTTPConnection object which will handle the requests of this connection.

Definition at line 144 of file precomp/HTTPServer/HTTPServer.h.


Constructor & Destructor Documentation

HTTPConnection ( HTTPServer parent,
struct tcp_pcb *  pcb 
)

Constructs a new connection object from a server.

It just need the server object to contact the handlers and the tcp connection pcb.

Parameters:
parentThe server which created the connection.
pcbThe pcb object NetServers internal representation of an TCP Connection

Definition at line 18 of file tag/13/HTTPServer/HTTPServer.cpp.

~HTTPConnection (  ) [virtual]

Default destructor.

Simple cleanup.

Definition at line 26 of file tag/13/HTTPServer/HTTPServer.cpp.

HTTPConnection ( HTTPServer parent,
struct tcp_pcb *  pcb 
)

Constructs a new connection object from a server.

It just need the server object to contact the handlers and the tcp connection pcb.

Parameters:
parentThe server which created the connection.
pcbThe pcb object NetServers internal representation of an TCP Connection
virtual ~HTTPConnection (  ) [virtual]

Default destructor.

Simple cleanup.

HTTPConnection ( HTTPServer parent,
struct tcp_pcb *  pcb 
)

Constructs a new connection object from a server.

It just need the server object to contact the handlers and the tcp connection pcb.

Parameters:
parentThe server which created the connection.
pcbThe pcb object NetServers internal representation of an TCP Connection
virtual ~HTTPConnection (  ) [virtual]

Default destructor.

Simple cleanup.

HTTPConnection ( HTTPServer parent,
struct tcp_pcb *  pcb 
)

Constructs a new connection object from a server.

It just need the server object to contact the handlers and the tcp connection pcb.

Parameters:
parentThe server which created the connection.
pcbThe pcb object NetServers internal representation of an TCP Connection
virtual ~HTTPConnection (  ) [virtual]

Default destructor.

Simple cleanup.

HTTPConnection ( HTTPServer parent,
struct tcp_pcb *  pcb 
)

Constructs a new connection object from a server.

It just need the server object to contact the handlers and the tcp connection pcb.

Parameters:
parentThe server which created the connection.
pcbThe pcb object NetServers internal representation of an TCP Connection
virtual ~HTTPConnection (  ) [virtual]

Default destructor.

Simple cleanup.


Member Function Documentation

void addField ( char *  key,
char *  value 
)

For internal usage.

Adds an header field value to its hash. If it was registered You can see the Value with the getField method

void addField ( char *  key,
char *  value 
)

For internal usage.

Adds an header field value to its hash. If it was registered You can see the Value with the getField method

void addField ( char *  key,
char *  value 
)

For internal usage.

Adds an header field value to its hash. If it was registered You can see the Value with the getField method

Definition at line 36 of file tag/13/HTTPServer/HTTPServer.cpp.

void addField ( char *  key,
char *  value 
)

For internal usage.

Adds an header field value to its hash. If it was registered You can see the Value with the getField method

void addField ( char *  key,
char *  value 
)

For internal usage.

Adds an header field value to its hash. If it was registered You can see the Value with the getField method

err_t connected ( err_t  err ) [protected, virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored

Definition at line 73 of file tcpconnection.cpp.

virtual err_t connected ( err_t  err ) [virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored
virtual err_t connected ( err_t  err ) [protected, virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored
virtual err_t connected ( err_t  err ) [protected, virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored
virtual err_t connected ( err_t  err ) [protected, virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored
virtual err_t connected ( err_t  err ) [protected, virtual, inherited]

Function to be called when a connection has been set up.

Parameters:
pcbthe tcp_pcb that now is connected
erran error argument (TODO: that is current always ERR_OK?)
Returns:
value is currently ignored
const char* getField ( char *  key ) const

Gets a value from a header field of the request header.

But you must have registerd this headerfield by the HTTPServer before. Use the HTTPHandler::reg() method for the registration of important header fields for your Handler.

const char* getField ( char *  key ) const

Gets a value from a header field of the request header.

But you must have registerd this headerfield by the HTTPServer before. Use the HTTPHandler::reg() method for the registration of important header fields for your Handler.

const char* getField ( char *  key ) const

Gets a value from a header field of the request header.

But you must have registerd this headerfield by the HTTPServer before. Use the HTTPHandler::reg() method for the registration of important header fields for your Handler.

const char* getField ( char *  key ) const

Gets a value from a header field of the request header.

But you must have registerd this headerfield by the HTTPServer before. Use the HTTPHandler::reg() method for the registration of important header fields for your Handler.

const char * getField ( char *  key ) const

Gets a value from a header field of the request header.

But you must have registerd this headerfield by the HTTPServer before. Use the HTTPHandler::reg() method for the registration of important header fields for your Handler.

Definition at line 31 of file tag/13/HTTPServer/HTTPServer.cpp.

const char* getHeaderFields (  ) const

Gets a string of set fields to send with the answere header.

Definition at line 168 of file trunk/HTTPServer/HTTPServer.h.

const char* getHeaderFields (  ) const

Gets a string of set fields to send with the answere header.

Definition at line 168 of file tag/13-precomp/HTTPServer/HTTPServer.h.

const char* getHeaderFields (  ) const

Gets a string of set fields to send with the answere header.

Definition at line 168 of file tag/13/HTTPServer/HTTPServer.h.

const char* getHeaderFields (  ) const

Gets a string of set fields to send with the answere header.

Definition at line 168 of file precomp/HTTPServer/HTTPServer.h.

const char* getHeaderFields (  ) const

Gets a string of set fields to send with the answere header.

Definition at line 168 of file tag/7/HTTPServer/HTTPServer.h.

const int& getLength (  ) const

Gets the length of the anwere in bytes.

This is requiered for the HTTP Header. It should be set over setLength by an HTTPHandler in the init() method.

Definition at line 174 of file trunk/HTTPServer/HTTPServer.h.

const int& getLength (  ) const

Gets the length of the anwere in bytes.

This is requiered for the HTTP Header. It should be set over setLength by an HTTPHandler in the init() method.

Definition at line 174 of file tag/13-precomp/HTTPServer/HTTPServer.h.

const int& getLength (  ) const

Gets the length of the anwere in bytes.

This is requiered for the HTTP Header. It should be set over setLength by an HTTPHandler in the init() method.

Definition at line 174 of file tag/13/HTTPServer/HTTPServer.h.

const int& getLength (  ) const

Gets the length of the anwere in bytes.

This is requiered for the HTTP Header. It should be set over setLength by an HTTPHandler in the init() method.

Definition at line 174 of file precomp/HTTPServer/HTTPServer.h.

const int& getLength (  ) const

Gets the length of the anwere in bytes.

This is requiered for the HTTP Header. It should be set over setLength by an HTTPHandler in the init() method.

Definition at line 174 of file tag/7/HTTPServer/HTTPServer.h.

const char& getType (  ) const

Gets POST or GET or 0 depends on wether ther is a request and what type is requested.

Definition at line 179 of file trunk/HTTPServer/HTTPServer.h.

const char& getType (  ) const

Gets POST or GET or 0 depends on wether ther is a request and what type is requested.

Definition at line 179 of file tag/13-precomp/HTTPServer/HTTPServer.h.

const char& getType (  ) const

Gets POST or GET or 0 depends on wether ther is a request and what type is requested.

Definition at line 179 of file precomp/HTTPServer/HTTPServer.h.

const char& getType (  ) const

Gets POST or GET or 0 depends on wether ther is a request and what type is requested.

Definition at line 179 of file tag/13/HTTPServer/HTTPServer.h.

const char& getType (  ) const

Gets POST or GET or 0 depends on wether ther is a request and what type is requested.

Definition at line 179 of file tag/7/HTTPServer/HTTPServer.h.

char* getURL (  ) const

Get the requested url.

Only set if a request ist received.

Definition at line 163 of file trunk/HTTPServer/HTTPServer.h.

char* getURL (  ) const

Get the requested url.

Only set if a request ist received.

Definition at line 163 of file tag/13-precomp/HTTPServer/HTTPServer.h.

char* getURL (  ) const

Get the requested url.

Only set if a request ist received.

Definition at line 163 of file tag/13/HTTPServer/HTTPServer.h.

char* getURL (  ) const

Get the requested url.

Only set if a request ist received.

Definition at line 163 of file precomp/HTTPServer/HTTPServer.h.

char* getURL (  ) const

Get the requested url.

Only set if a request ist received.

Definition at line 163 of file tag/7/HTTPServer/HTTPServer.h.

void setHeaderFields ( char *  value )

Set the response header field to a value.

Should be used in the HTTPHandler::init() method. For example if you want to set caching methods.

Definition at line 205 of file tag/13-precomp/HTTPServer/HTTPServer.h.

void setHeaderFields ( char *  value )

Set the response header field to a value.

Should be used in the HTTPHandler::init() method. For example if you want to set caching methods.

Definition at line 205 of file tag/7/HTTPServer/HTTPServer.h.

void setHeaderFields ( char *  value )

Set the response header field to a value.

Should be used in the HTTPHandler::init() method. For example if you want to set caching methods.

Definition at line 205 of file precomp/HTTPServer/HTTPServer.h.

void setHeaderFields ( char *  value )

Set the response header field to a value.

Should be used in the HTTPHandler::init() method. For example if you want to set caching methods.

Definition at line 205 of file trunk/HTTPServer/HTTPServer.h.

void setHeaderFields ( char *  value )

Set the response header field to a value.

Should be used in the HTTPHandler::init() method. For example if you want to set caching methods.

Definition at line 205 of file tag/13/HTTPServer/HTTPServer.h.

void setLength ( const int &  value )

Sets the result length for an request shoud be set in an HTTPHandler.init() call.

This Value will be send with the response header before the first chunk of data is send.

Definition at line 198 of file tag/13-precomp/HTTPServer/HTTPServer.h.

void setLength ( const int &  value )

Sets the result length for an request shoud be set in an HTTPHandler.init() call.

This Value will be send with the response header before the first chunk of data is send.

Definition at line 198 of file precomp/HTTPServer/HTTPServer.h.

void setLength ( const int &  value )

Sets the result length for an request shoud be set in an HTTPHandler.init() call.

This Value will be send with the response header before the first chunk of data is send.

Definition at line 198 of file trunk/HTTPServer/HTTPServer.h.

void setLength ( const int &  value )

Sets the result length for an request shoud be set in an HTTPHandler.init() call.

This Value will be send with the response header before the first chunk of data is send.

Definition at line 198 of file tag/13/HTTPServer/HTTPServer.h.

void setLength ( const int &  value )

Sets the result length for an request shoud be set in an HTTPHandler.init() call.

This Value will be send with the response header before the first chunk of data is send.

Definition at line 198 of file tag/7/HTTPServer/HTTPServer.h.


Field Documentation

If an request is complete HTTPHandler:init will be called and can store here its connection data.

Definition at line 211 of file precomp/HTTPServer/HTTPServer.h.

The HTTTPServer which created this connection.

Definition at line 220 of file precomp/HTTPServer/HTTPServer.h.

The handler which handles the current request.

Depends on the prefix of the URL.

Definition at line 214 of file precomp/HTTPServer/HTTPServer.h.

Indicates that if a request is received the header is incomplete until now.

Definition at line 208 of file precomp/HTTPServer/HTTPServer.h.

HTTPStatus request_status

The status of the request.

Will be set as result of HTTPHandler::init.

Definition at line 217 of file precomp/HTTPServer/HTTPServer.h.