diff --git a/backends/libyahoo2/httpfetch.h b/backends/libyahoo2/httpfetch.h new file mode 100644 index 0000000000000000000000000000000000000000..1d9a3899e38fc13654516bfae82f9df4cfc172f3 --- /dev/null +++ b/backends/libyahoo2/httpfetch.h @@ -0,0 +1,43 @@ +#pragma once + +// Transport includes +#include "transport/config.h" +#include "transport/networkplugin.h" +#include "transport/logging.h" + +// Swiften +#include "Swiften/Swiften.h" +#include "Swiften/TLS/OpenSSL/OpenSSLContextFactory.h" + +// for signal handler +#include "unistd.h" +#include "signal.h" +#include "sys/wait.h" +#include "sys/signal.h" + +// Boost +#include + +using namespace boost::filesystem; +using namespace boost::program_options; +using namespace Transport; + +class HTTPFetch { + public: + HTTPFetch(Swift::BoostIOServiceThread *ioSerice, Swift::ConnectionFactory *factory); + virtual ~HTTPFetch(); + + bool fetchURL(const std::string &url); + + boost::signal onURLFetched; + + private: + void _connected(boost::shared_ptr conn, const std::string url, bool error); + void _disconnected(boost::shared_ptr conn); + void _read(boost::shared_ptr conn, boost::shared_ptr data); + + Swift::BoostIOServiceThread *m_ioService; + Swift::ConnectionFactory *m_factory; + std::string m_buffer; + bool m_afterHeader; +};