/* */ #ifndef D_HTTP_INITIATE_CONNECTION_COMMAND_H #define D_HTTP_INITIATE_CONNECTION_COMMAND_H #include "InitiateConnectionCommand.h" namespace aria2 { // HttpInitiateConnectionCommand determines remote host to connect and // resolves IP address from that hostname and creates subsequent // command. Usually, remote host is the host in URI. If proxy is // used, remote host becomes proxy server. This command searches // pooled socket using resolved IP addresses and use pooled socket if // available. The following chart shows what Command is followed // after this command based on conditions. // // HttpInitiateConnectionCommand // | // | proxy is used? // +----------------+ // | | // | | pooled socket? // | +------------> HttpRequestCommand // | | tunnel? // | +------------> HttpProxyRequestCommand // | | otherwise // | +------------> HttpRequestCommand // | direct connection // +-----------------------------> HttpRequestCommand // // HttpInitiateConnectionCommand::execute() returns true when DNS is // in synchronous mode and address resolution was complete. When DNS // is in asynchronous mode, it may return false: This means address // resolution is in progress. After address resolution completed, // calling execute() returns true. class HttpInitiateConnectionCommand : public InitiateConnectionCommand { protected: virtual Command* createNextCommand (const std::string& hostname, const std::string& addr, uint16_t port, const std::vector& resolvedAddresses, const std::shared_ptr& proxyRequest); public: HttpInitiateConnectionCommand(cuid_t cuid, const std::shared_ptr& req, const std::shared_ptr& fileEntry, RequestGroup* requestGroup, DownloadEngine* e); virtual ~HttpInitiateConnectionCommand(); }; } // namespace aria2 #endif // D_HTTP_INITIATE_CONNECTION_COMMAND_H