#pragma once #include #include #include class CTCPSocket; class CHttpJob final : public CNetworkJob { C_OBJECT(CHttpJob) public: explicit CHttpJob(const CHttpRequest&); virtual ~CHttpJob() override; virtual void start() override; private: void on_socket_connected(); enum class State { InStatus, InHeaders, InBody, Finished, }; CHttpRequest m_request; CTCPSocket* m_socket { nullptr }; State m_state { State::InStatus }; int m_code { -1 }; HashMap m_headers; };