/* */ #include "AbstractProxyResponseCommand.h" #include "HttpConnection.h" #include "Request.h" #include "Segment.h" #include "RequestGroup.h" #include "DownloadEngine.h" #include "HttpRequest.h" #include "HttpResponse.h" #include "HttpRequestCommand.h" #include "SocketCore.h" #include "DlRetryEx.h" #include "message.h" #include "HttpHeader.h" #include "DownloadContext.h" #include "SocketRecvBuffer.h" namespace aria2 { AbstractProxyResponseCommand::AbstractProxyResponseCommand( cuid_t cuid, const std::shared_ptr& req, const std::shared_ptr& fileEntry, RequestGroup* requestGroup, const std::shared_ptr& httpConnection, DownloadEngine* e, const std::shared_ptr& s) : AbstractCommand(cuid, req, fileEntry, requestGroup, e, s), httpConnection_(httpConnection) { } AbstractProxyResponseCommand::~AbstractProxyResponseCommand() = default; bool AbstractProxyResponseCommand::executeInternal() { std::shared_ptr httpResponse = httpConnection_->receiveResponse(); if (!httpResponse) { // the server has not responded our request yet. addCommandSelf(); return false; } if (httpResponse->getStatusCode() != 200) { throw DL_RETRY_EX(EX_PROXY_CONNECTION_FAILED); } getDownloadEngine()->addCommand(getNextCommand()); return true; } } // namespace aria2