<commit_before>#ifndef HTTPREQUESTHANDLER_H
#define HTTPREQUESTHANDLER_H

#include <QObject>
#include <QHash>
#include <QString>
#include <QVariant>

#include "httprequest.h"
#include "httpresponse.h"

/* TODO: https://qt-project.org/doc/qt-4.8/plugins-howto.html
 * says that I should have only pure virtual functions, is it ok not to?
 */

class HTTPRequestHandler : public QObject
{
    Q_OBJECT
public:
    HTTPRequestHandler(){}
    HTTPRequestHandler(const QHash<QString, QVariant> &s, QObject *parent=0) :
        QObject(parent), settings(s) {}

    virtual ~HTTPRequestHandler() {}
    virtual void createResponse(const HTTPRequest &r)=0;

protected:
    const QHash<QString, QVariant> settings;

signals:
    void responseWritten(HTTPResponse response);
    void endOfWriting();
};

#endif // HTTPREQUESTHANDLER_H
<commit_msg>allowing plugins to write raw data as response - speed reasons<commit_after>#ifndef HTTPREQUESTHANDLER_H
#define HTTPREQUESTHANDLER_H

#include <QObject>
#include <QHash>
#include <QString>
#include <QVariant>

#include "httprequest.h"
#include "httpresponse.h"

/* TODO: https://qt-project.org/doc/qt-4.8/plugins-howto.html
 * says that I should have only pure virtual functions, is it ok not to?
 */

class HTTPRequestHandler : public QObject
{
    Q_OBJECT
public:
    HTTPRequestHandler(){}
    HTTPRequestHandler(const QHash<QString, QVariant> &s, QObject *parent=0) :
        QObject(parent), settings(s) {}

    virtual ~HTTPRequestHandler() {}
    virtual void createResponse(const HTTPRequest &r)=0;

protected:
    const QHash<QString, QVariant> settings;

signals:
    void responseWritten(HTTPResponse response);
    void rawDataWritten(uchar *data, int size);
    void endOfWriting();
};

#endif // HTTPREQUESTHANDLER_H

{'fraction_non_alphanumeric': 0.11192764273600904, 'fraction_numerical': 0.0045223289994347085, 'mean_word_length': 4.728155339805825, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6773710', 'n_tokens_mistral': 567, 'n_tokens_neox': 559, 'n_words': 148}