<commit_before>#ifndef HTTP_HPP
#define HTTP_HPP

#include "../api/InetObject.hpp"
#include "../var/String.hpp"
#include "Socket.hpp"

namespace inet {





class Http : public api::InetWorkObject {
public:
    Http();


private:
    //server name
    //port

    //socket to use

};


class HttpClient : public Http {
public:
    HttpClient();


    int head(const var::ConstString & url, var::String & response);
    int get(const var::ConstString & url, var::String & response);
    int post(const var::ConstString & url, const var::ConstString & data, var::String & response);
    int put(const var::ConstString & url, const var::ConstString & data, var::String & response);
    int patch(const var::ConstString & url, const var::ConstString & data, var::String & response);

    //http delete
    int remove(const var::ConstString & url, const var::ConstString & data, var::String & response);

    int options(const var::ConstString & url);
    int trace(const var::ConstString & url);
    int connect(const var::ConstString & url);


    const var::String & header() const { return m_header; }

private:


    var::String m_header;

};

class HttpServer : public Http {
public:<commit_msg>Added API info for HttpClient<commit_after>#ifndef HTTP_HPP
#define HTTP_HPP

#include "../api/InetObject.hpp"
#include "../var/String.hpp"
#include "Socket.hpp"

namespace inet {





class Http : public api::InetWorkObject {
public:
    Http();


protected:

    Socket & socket(){ return m_socket; }

private:
    //server name
    //port

    //socket to use
    Socket m_socket;

};


class HttpClient : public Http {
public:
    HttpClient();


    int head(const var::ConstString & url);
    int get(const var::ConstString & url);
    int post(const var::ConstString & url, const var::Data & data);
    int put(const var::ConstString & url, const var::Data & data);
    int patch(const var::ConstString & url, const var::Data & data);

    //http delete
    int remove(const var::ConstString & url, const var::ConstString & data, var::String & response);

    int options(const var::ConstString & url);
    int trace(const var::ConstString & url);
    int connect(const var::ConstString & url);


    /*! \details Returns a reference to the header that is returned
     * by the request.
     *
     */
    const var::String & header() const { return m_header; }

    /*! \details Returns a reference to the response that is returned
     * by the request.
     *
     *
     */
    const var::Data & response(){ return m_response; }


    /*! \details Handles incoming data if the response size exceeds maximum_response_size().
     *
     * @return Return true to continue the request and false to abort.
     *
     */
    virtual bool handle_incoming_data(){ return true; }

    /*! \details Sets the maximum amount of data that can be allocated
     * for the response.
     *
     * If the response exceeds maximum data size, handle_incoming_data() will
     * be called. The application should implement handle_incoming_data() to
     * store the data (e.g. to a file). If handle_incoming_data() returns false,
     * the request will be aborted.
     *
     */
    void set_maximum_response_size(u32 value){
        m_maximum_response_size = value;
    }

    /*! \details Returns the maximum number of bytes that can be allocated for the response
     * to any request.
     *
     * See set_maximum_response_size() for details.
     *
     */
    u32 maximum_response_size() const { return m_maximum_response_size; }

private:

    u32 m_maximum_response_size;
    var::String m_header;
    var::Data m_response;

};

class HttpServer : public Http {
public:
{'fraction_non_alphanumeric': 0.11332062108417325, 'fraction_numerical': 0.0016344320348678834, 'mean_word_length': 3.1397970687711387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '730326', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1053, 'n_words': 353}