NuriaProject Framework
0.1
The NuriaProject Framework
|
A filter can modify a HttpClients outgoing stream. More...
#include <httpfilter.hpp>
Public Member Functions | |
HttpFilter (QObject *parent=0) | |
~HttpFilter () override | |
virtual QByteArray | filterBegin (HttpClient *client) |
virtual bool | filterData (HttpClient *client, QByteArray &data) |
virtual QByteArray | filterEnd (HttpClient *client) |
virtual bool | filterHeaders (HttpClient *client, HttpClient::HeaderMap &headers) |
virtual QByteArray | filterName () const |
A filter can modify a HttpClients outgoing stream.
Filters allow you to modify the data a HttpClient sends back. This can be used to implement compression algorithms or on-the-fly "minifiers".
|
explicit |
Constructor.
|
override |
Destructor.
|
virtual |
Called before the response body is sent. Implementations can return a QByteArray which, if not empty, will be sent to client. The default implementation returns an empty QByteArray.
|
virtual |
Called before data is sent to the client. Implementations can modify data at will or even empty it. Returning false
indicates an error and will instruct client to not send anything.
The default implementation returns true
.
|
virtual |
Called after the response body has been sent. Implementations can return a QByteArray which will be sent to the remote client. The default implementation returns an empty QByteArray.
|
virtual |
Called before the HTTP header is sent by client. The implementation can change headers at will. Returning false
indicates an error and will instruct client to not send anything.
The default implementation returns true
.
|
virtual |
Returns the name of the filter. If the filter returns a non-empty QByteArray, it will only be triggered if the client mentions it in the "Accept-Encoding" HTTP header.
Also, if a non-empty QByteArray is returned, it will automatically be added to the "Content-Encoding" header upon sending.
The default implementation returns an empty QByteArray.