class EE::Network::Http::Pool

Overview

HTTP Client Pool. More…

#include <http.hpp>

class Pool {
public:
    // construction

    ~Pool();

    // methods

    static Pool& getGlobal();
    void clear();
    bool exists(const URI& host, const URI& proxy = URI());
    Http* get(const URI& host, const URI& proxy = URI());
};

Detailed Documentation

HTTP Client Pool. Will keep the instances of the HTTP clients until the Pool is destroyed. Acts as a host client cache.

Methods

static Pool& getGlobal()

Returns:

The reference to the global HTTP Pool A global HTTP Pool is created at the program start

void clear()

Clear all the HTTP Clients

bool exists(const URI& host, const URI& proxy = URI())

Parameters:

host

The scheme + hostname + port represented as an URI.

proxy

The client proxy if any, scheme + hostname + post as URI.

Returns:

True if the client already exists in the pool

Http* get(const URI& host, const URI& proxy = URI())

Parameters:

host

The scheme + hostname + port represented as an URI.

proxy

The client proxy if any, scheme + hostname + post as URI.

Returns:

An HTTP Client to the host and proxy ( creates one if no one is found )