/* */ #include "HttpRequestCommand.h" #include "HttpResponseCommand.h" #include "HttpConnection.h" HttpRequestCommand::HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) { setReadCheckSocket(NULL); setWriteCheckSocket(socket); } HttpRequestCommand::~HttpRequestCommand() {} bool HttpRequestCommand::executeInternal(Segment seg) { socket->setBlockingMode(); if(req->getProtocol() == "https") { socket->initiateSecureConnection(); } HttpConnection http(cuid, socket, req, e->option); // set seg to request in order to remember the request range req->seg = seg; http.sendRequest(seg); Command* command = getNextCommand(); e->commands.push(command); return true; } Command* HttpRequestCommand::getNextCommand() const { return new HttpResponseCommand(cuid, req, e, socket); }