diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-02-18 16:31:41 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-02-18 16:31:41 +0000 |
| commit | b0628082d0ad183c953193da5c0cd38f5ede282d (patch) | |
| tree | 44f5b2594da0a17010a6e64182206dd5e711baeb /trunk/src | |
| parent | 81b2c9c6399505eba31e6096f43e6ce557a3a6ad (diff) | |
Tagging the 0.2.0 release of aria2
Diffstat (limited to 'trunk/src')
70 files changed, 5851 insertions, 0 deletions
diff --git a/trunk/src/AbstractCommand.cc b/trunk/src/AbstractCommand.cc new file mode 100644 index 00000000..0a2f78d3 --- /dev/null +++ b/trunk/src/AbstractCommand.cc @@ -0,0 +1,127 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "AbstractCommand.h" +#include "DlAbortEx.h" +#include "DlRetryEx.h" +#include "InitiateConnectionCommandFactory.h" +#include <sys/time.h> +#include "Util.h" +#include "message.h" +#include "SleepCommand.h" + +#define TIMEOUT_SEC 5 + +AbstractCommand::AbstractCommand(int cuid, Request* req, DownloadEngine* e, Socket* s): + Command(cuid), req(req), e(e), checkSocketIsReadable(false), checkSocketIsWritable(false) { + if(s != NULL) { + socket = new Socket(*s); + e->addSocketForReadCheck(socket); + } else { + socket = NULL; + } + this->checkPoint.tv_sec = 0; + this->checkPoint.tv_usec = 0; +} + +AbstractCommand::~AbstractCommand() { + e->deleteSocketForReadCheck(socket); + e->deleteSocketForWriteCheck(socket); + if(socket != NULL) { + delete(socket); + } +} + +void AbstractCommand::updateCheckPoint() { + gettimeofday(&checkPoint, NULL); +} + +bool AbstractCommand::isTimeoutDetected() { + struct timeval now; + gettimeofday(&now, NULL); + if(checkPoint.tv_sec == 0 && checkPoint.tv_usec == 0) { + return false; + } else { + long long int elapsed = Util::difftv(now, checkPoint); + if(elapsed >= TIMEOUT_SEC*1000000) { + return true; + } else { + return false; + } + } +} + +bool AbstractCommand::execute() { + try { + if(checkSocketIsReadable && !socket->isReadable(0) + || checkSocketIsWritable && !socket->isWritable(0)) { + if(isTimeoutDetected()) { + throw new DlRetryEx(EX_TIME_OUT); + } + updateCheckPoint(); + e->commands.push(this); + return false; + } + updateCheckPoint(); + Segment seg = { 0, 0, 0, false }; + if(e->segmentMan->downloadStarted) { + // get segment information in order to set Range header. + if(!e->segmentMan->getSegment(seg, cuid)) { + // no segment available + e->logger->info(MSG_NO_SEGMENT_AVAILABLE, cuid); + return true; + } + } + return executeInternal(seg); + } catch(DlAbortEx* err) { + e->logger->error(MSG_DOWNLOAD_ABORTED, err, cuid); + onError(err); + delete(err); + req->resetUrl(); + return true; + } catch(DlRetryEx* err) { + e->logger->error(MSG_RESTARTING_DOWNLOAD, err, cuid); + onError(err); + delete(err); + //req->resetUrl(); + req->addRetryCount(); + if(req->noMoreRetry()) { + e->logger->error(MSG_MAX_RETRY, cuid); + return true; + } else { + return prepareForRetry(e->option->getAsInt("retry_wait")); + } + } +} + +bool AbstractCommand::prepareForRetry(int wait) { + Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, e); + if(wait == 0) { + e->commands.push(command); + } else { + SleepCommand* scom = new SleepCommand(cuid, e, command, wait); + e->commands.push(scom); + } + return true; +} + +void AbstractCommand::onError(Exception* e) { +} diff --git a/trunk/src/AbstractCommand.h b/trunk/src/AbstractCommand.h new file mode 100644 index 00000000..3d94511b --- /dev/null +++ b/trunk/src/AbstractCommand.h @@ -0,0 +1,51 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_ABSTRACT_COMMAND_H_ +#define _D_ABSTRACT_COMMAND_H_ + +#include "Command.h" +#include "Request.h" +#include "DownloadEngine.h" +#include "SegmentMan.h" +#include "common.h" + +class AbstractCommand : public Command { +private: + void updateCheckPoint(); + bool isTimeoutDetected(); + struct timeval checkPoint; +protected: + Request* req; + DownloadEngine* e; + Socket* socket; + bool checkSocketIsReadable; + bool checkSocketIsWritable; + virtual bool prepareForRetry(int wait); + virtual void onError(Exception* e); + virtual bool executeInternal(Segment segment) = 0; +public: + AbstractCommand(int cuid, Request* req, DownloadEngine* e, Socket* s= NULL); + virtual ~AbstractCommand(); + bool execute(); +}; + +#endif // _D_ABSTRACT_COMMAND_H_ diff --git a/trunk/src/AbstractDiskWriter.cc b/trunk/src/AbstractDiskWriter.cc new file mode 100644 index 00000000..501b1bbf --- /dev/null +++ b/trunk/src/AbstractDiskWriter.cc @@ -0,0 +1,72 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "AbstractDiskWriter.h" +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <fcntl.h> +#include "DlAbortEx.h" +#include "File.h" + +AbstractDiskWriter::AbstractDiskWriter():fd(0) {} + +AbstractDiskWriter::~AbstractDiskWriter() { + if(fd != 0) { + close(fd); + } +} + +void AbstractDiskWriter::closeFile() { + if(fd != 0) { + close(fd); + fd = 0; + } +} + +void AbstractDiskWriter::openExistingFile(string filename) { + File f(filename); + if(!f.isFile()) { + throw new DlAbortEx(strerror(errno)); + } + + if((fd = open(filename.c_str(), O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { + throw new DlAbortEx(strerror(errno)); + } +} + +void AbstractDiskWriter::createFile(string filename, int addFlags) { + // TODO proper filename handling needed + assert(filename.size()); +// if(filename.empty()) { +// filename = "index.html"; +// } + if((fd = open(filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC|addFlags, S_IRUSR|S_IWUSR)) < 0) { + throw new DlAbortEx(strerror(errno)); + } +} + +void AbstractDiskWriter::writeDataInternal(const char* data, int len) { + if(write(fd, data, len) < 0) { + throw new DlAbortEx(strerror(errno)); + } +} diff --git a/trunk/src/AbstractDiskWriter.h b/trunk/src/AbstractDiskWriter.h new file mode 100644 index 00000000..c32ddc34 --- /dev/null +++ b/trunk/src/AbstractDiskWriter.h @@ -0,0 +1,43 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_ABSTRACT_DISK_WRITER_H_ +#define _D_ABSTRACT_DISK_WRITER_H_ + +#include "DiskWriter.h" + +class AbstractDiskWriter:public DiskWriter { +protected: + int fd; + + void createFile(string filename, int addFlags = 0); + + void writeDataInternal(const char* data, int len); +public: + AbstractDiskWriter(); + virtual ~AbstractDiskWriter(); + + void closeFile(); + + void openExistingFile(string filename); +}; + +#endif // _D_ABSTRACT_DISK_WRITER_H_ diff --git a/trunk/src/Base64.cc b/trunk/src/Base64.cc new file mode 100644 index 00000000..e0b3aa86 --- /dev/null +++ b/trunk/src/Base64.cc @@ -0,0 +1,126 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "Base64.h" + +string Base64::part_encode(const string& subplain) +{ + static char base64_table[64] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '+', '/', + }; + + int shift = 2; + char carry = 0; + bool ignore_flag = false; + string crypted; + + for(unsigned int index = 0; index < subplain.size(); ++index) { + if(ignore_flag) { + crypted += '='; + } else { + char cur = subplain.at(index) >> shift | carry; + if(subplain.at(index) == 0) ignore_flag = true; + carry = (subplain.at(index) << (6-shift)) & 0x3F; + shift += 2; + crypted += base64_table[(unsigned int)cur]; + } + } + if(subplain.at(subplain.size()-1) == 0) { + crypted += '='; + } else { + char cur = subplain.at(subplain.size()-1) & 0x3F; + crypted += base64_table[(unsigned int)cur]; + } + + return crypted; +} + +string Base64::encode(string plain) +{ + int remainder = plain.size() % 3; + if( remainder ) remainder = 3-remainder; + for(int i = 0; i < remainder; ++i) plain += (char)0; + string crypted; + int start_pos = 0; + for(unsigned int index = 0; plain.size() > index; index += 3) { + string subplain = plain.substr(start_pos, 3); + string subcrypted = part_encode(subplain); + start_pos += 3; + crypted += subcrypted; + } + return crypted; +} + +char Base64::getValue(char ch) +{ + char retch; + + if(ch >= 'A' && ch <= 'Z') { + retch = ch-'A'; + } else if(ch >= 'a' && ch <= 'z') { + retch = ch-'a'+26; + } else if(ch >= '0' && ch <= '9') { + retch = ch-'0'+52; + } else if(ch == '+') { + retch = 62; + } else if(ch == '/') { + retch = 63; + } else { + retch = 0; + } + return retch; +} + +string Base64::part_decode(const string& subCrypted) +{ + int shift = 2; + string plain; + + for(unsigned int index = 0; index < subCrypted.size()-1; ++index) { + if(subCrypted.at(index) == '=') break; + char cur = getValue(subCrypted.at(index)) << shift; + char carry = getValue(subCrypted.at(index+1)) >> (6-shift); + shift += 2; + plain += cur | carry; + } + + return plain; +} + +string Base64::decode(string crypted) +{ + string plain; + int sIndex = 0; + for(int index = 0; crypted.size() > (unsigned int)index; index +=4) { + string subCrypted = crypted.substr(sIndex, 4); + string subPlain = part_decode(subCrypted); + sIndex += 4; + plain += subPlain; + } + return plain; +} diff --git a/trunk/src/Base64.h b/trunk/src/Base64.h new file mode 100644 index 00000000..e5d06d60 --- /dev/null +++ b/trunk/src/Base64.h @@ -0,0 +1,38 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _BASE64_H_ +#define _BASE64_H_ +#include <string> +using namespace std; + +class Base64 +{ +private: + static string part_encode(const string& subplain); + static string part_decode(const string& subCrypted); + static char getValue(char ch); +public: + static string encode(string plain); + static string decode(string crypted); +}; + +#endif // _BASE64_H_ diff --git a/trunk/src/ChunkedEncoding.cc b/trunk/src/ChunkedEncoding.cc new file mode 100644 index 00000000..80670601 --- /dev/null +++ b/trunk/src/ChunkedEncoding.cc @@ -0,0 +1,173 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "ChunkedEncoding.h" +#include "DlAbortEx.h" +#include "message.h" +#include <string.h> +#include <errno.h> + +#define MAX_BUFSIZE (1024*1024) + +ChunkedEncoding::ChunkedEncoding() { + strbufSize = 4096; + strbuf = new char[strbufSize]; + strbuf[0] = '\0'; + state = READ_SIZE; + chunkSize = 0; +} + +ChunkedEncoding::~ChunkedEncoding() { + if(strbuf != NULL) { + delete [] strbuf; + } +} + +void ChunkedEncoding::init() { +} + +bool ChunkedEncoding::finished() { + return state == FINISH ? true : false; +} + +void ChunkedEncoding::end() {} + +void ChunkedEncoding::inflate(char* outbuf, int& outlen, const char* inbuf, int inlen) { + addBuffer(inbuf, inlen); + char* p = strbuf; + int clen = 0; + while(1) { + if(state == READ_SIZE) { + if(readChunkSize(&p) == 0) { + if(chunkSize == 0) { + state = FINISH; + } else { + state = READ_DATA; + } + } else { + // chunk size is not fully received. + break; + } + } else if(state == READ_DATA) { + if(readData(&p, outbuf, clen, outlen) == 0) { + state = READ_SIZE; + } else { + break; + } + } else { + break; + } + // Was all bytes in strbuf examined? + if(strbuf+strlen(strbuf) <= p) { + break; + } + } + if(strbuf+strlen(strbuf) <= p) { + // make strbuf NULL-string + strbuf[0] = '\0'; + } else { + // copy string between [p, strbuf+strlen(strbuf)+1], +1 is for NULL + // character. + char* temp = new char[strbufSize]; + memcpy(temp, p, strbuf+strlen(strbuf)-p+1); + delete [] strbuf; + strbuf = temp; + } + outlen = clen; +} + +int ChunkedEncoding::readData(char** pp, char* buf, int& len, int maxlen) { + if(buf+len == buf+maxlen) { + return -1; + } + if(chunkSize == 0) { + return readDataEOL(pp); + } + int wsize; + if(strlen(*pp) < (unsigned long int)chunkSize) { + wsize = strlen(*pp) <= (unsigned int)maxlen-len ? strlen(*pp) : maxlen-len; + } else { + wsize = chunkSize <= maxlen-len ? chunkSize : maxlen-len; + } + memcpy(buf+len, *pp, wsize); + chunkSize -= wsize; + len += wsize; + *pp += wsize; + + if(chunkSize == 0) { + return readDataEOL(pp); + } else { + return -1; + } +} + +int ChunkedEncoding::readDataEOL(char** pp) { + if(strstr(*pp, "\r\n") == *pp) { + *pp += 2; + return 0; + } else if(strlen(*pp) < 2) { + return -1; + } else { + throw new DlAbortEx(EX_INVALID_CHUNK_SIZE); + } +} + +// strbuf is NULL terminated string, and inlen is strlen(strbuf). +// therefore, strbuf[inlen] = '\0' +int ChunkedEncoding::readChunkSize(char** pp) { + // we read chunk-size from *pp + char* p = strstr(*pp, "\r\n"); + // \r\n is not found. Return -1 + if(p == NULL) { + return -1; + } + // We ignore chunk-extension + char* exsp = index(*pp, ';'); + if(exsp == NULL) { + exsp = p; + } + // TODO check invalid characters in buffer + chunkSize = strtol(*pp, NULL, 16); + if(chunkSize < 0) { + throw new DlAbortEx(EX_INVALID_CHUNK_SIZE); + } else if(errno == ERANGE && (chunkSize == LONG_MAX || chunkSize == LONG_MIN)) { + throw new DlAbortEx(strerror(errno)); + } + *pp = p+2; + + return 0; +} + +void ChunkedEncoding::addBuffer(const char* inbuf, int inlen) { + if(strlen(strbuf)+inlen >= (unsigned int)strbufSize) { + if(strlen(strbuf)+inlen+1 > MAX_BUFSIZE) { + throw new DlAbortEx(EX_TOO_LARGE_CHUNK, strlen(strbuf)+inlen+1); + } + strbufSize = strlen(strbuf)+inlen+1; + char* temp = new char[strbufSize]; + memcpy(temp, strbuf, strlen(strbuf)+1); + delete [] strbuf; + strbuf = temp; + } + int origlen = strlen(strbuf); + memcpy(strbuf+origlen, inbuf, inlen); + strbuf[origlen+inlen] = '\0'; +} diff --git a/trunk/src/ChunkedEncoding.h b/trunk/src/ChunkedEncoding.h new file mode 100644 index 00000000..bce035ee --- /dev/null +++ b/trunk/src/ChunkedEncoding.h @@ -0,0 +1,56 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_CHUNKED_ENCODING_H_ +#define _D_CHUNKED_ENCODING_H_ + +#include "TransferEncoding.h" +#include "common.h" + +class ChunkedEncoding:public TransferEncoding { +private: + enum STATE { + READ_SIZE, + READ_DATA, + FINISH + }; + long int chunkSize; + int state; + char* strbuf; + int strbufSize; + + int readChunkSize(char** pp); + int readData(char** pp, char* buf, int& len, int maxlen); + void addBuffer(const char* inbuf, int inlen); + int readDataEOL(char** pp); + + +public: + ChunkedEncoding(); + ~ChunkedEncoding(); + + void init(); + void inflate(char* outbuf, int& outlen, const char* inbuf, int inlen); + bool finished(); + void end(); +}; + +#endif // _D_CHUNKED_ENCODING_H_ diff --git a/trunk/src/Command.h b/trunk/src/Command.h new file mode 100644 index 00000000..a6fd6d90 --- /dev/null +++ b/trunk/src/Command.h @@ -0,0 +1,36 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_COMMAND_H_ +#define _D_COMMAND_H_ + +class Command { +protected: + int cuid; +public: + Command(int cuid):cuid(cuid) {} + virtual ~Command() {} + virtual bool execute() = 0; + + int getCuid() const { return cuid; } +}; + +#endif // _D_COMMAND_H_ diff --git a/trunk/src/ConnectionException.h b/trunk/src/ConnectionException.h new file mode 100644 index 00000000..cd71719e --- /dev/null +++ b/trunk/src/ConnectionException.h @@ -0,0 +1,33 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_CONNECTION_EXCEPTION_H_ +#define _D_CONNECTION_EXCEPTION_H_ + +#include "DlAbortEx.h" + +class ConnectionException:public DlAbortEx { +public: + ConnectionException():DlAbortEx() {} + ConnectionException(string msg):DlAbortEx() {} +}; + +#endif // _D_CONNECTION_EXCEPTION_H_ diff --git a/trunk/src/CookieBox.cc b/trunk/src/CookieBox.cc new file mode 100644 index 00000000..f6f818e8 --- /dev/null +++ b/trunk/src/CookieBox.cc @@ -0,0 +1,81 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "CookieBox.h" +#include "Util.h" + +CookieBox::CookieBox() {} + +CookieBox::~CookieBox() {} + +void CookieBox::add(const Cookie& cookie) { + cookies.push_back(cookie); +} + +void CookieBox::add(string cookieStr) { + Cookie c; + parse(c, cookieStr); + cookies.push_back(c); +} + +void CookieBox::setField(Cookie& cookie, string name, string value) const { + if(name.size() == string("secure").size() && + strcasecmp(name.c_str(), "secure") == 0) { + cookie.secure = true; + } else if(name.size() == string("domain").size() && strcasecmp(name.c_str(), "domain") == 0) { + cookie.domain = value; + } else if(name.size() == string("path").size() && strcasecmp(name.c_str(), "path") == 0) { + cookie.path = value; + } else if(name.size() == string("expires").size() && strcasecmp(name.c_str(), "expires") == 0) { + cookie.expires = value; + } else { + cookie.name = name; + cookie.value = value; + } +} + +void CookieBox::parse(Cookie& cookie, string cookieStr) const { + cookie.clear(); + vector<string> terms; + Util::slice(terms, cookieStr, ';'); + for(vector<string>::iterator itr = terms.begin(); itr != terms.end(); itr++) { + pair<string, string> nv; + Util::split(nv, *itr, '='); + setField(cookie, nv.first, nv.second); + } +} + +vector<Cookie> CookieBox::criteriaFind(string host, string dir, bool secure) const { + vector<Cookie> result; + for(vector<Cookie>::const_iterator itr = cookies.begin(); itr != cookies.end(); itr++) { + const Cookie& c = *itr; + if((secure || !c.secure && !secure) && + c.domain.size() <= host.size() && + c.path.size() <= dir.size() && + c.domain.compare(0, c.domain.size(), host, host.size()-c.domain.size(), c.domain.size()) == 0 && + c.path.compare(0, c.path.size(), dir, 0, c.path.size()) == 0) { + // TODO we currently ignore expire date. + result.push_back(c); + } + } + return result; +} + diff --git a/trunk/src/CookieBox.h b/trunk/src/CookieBox.h new file mode 100644 index 00000000..d2056a17 --- /dev/null +++ b/trunk/src/CookieBox.h @@ -0,0 +1,65 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_COOKIE_BOX_H_ +#define _D_COOKIE_BOX_H_ + +#include <string> +#include <vector> + +using namespace std; + +class Cookie { +public: + string name; + string value; + string expires; + string path; + string domain; + bool secure; +public: + Cookie(string name, string value, string expires, string path, string domain, bool secure):name(name), value(value), expires(expires), path(path), domain(domain), secure(secure) {} + Cookie():secure(false) {} + ~Cookie() {} + string toString() const { + return name+"="+value; + } + void clear() { + name = value = expires = path = domain = ""; + secure = false; + } +}; + +class CookieBox { +private: + vector<Cookie> cookies; + void setField(Cookie& cookie, string name, string value) const; +public: + CookieBox(); + ~CookieBox(); + void clear(); + void add(const Cookie& cookie); + void add(string cookieStr); + void parse(Cookie& cookie, string cookieStr) const; + vector<Cookie> criteriaFind(string host, string dir, bool secure) const; +}; + +#endif // _D_COOKIE_BOX_H_ diff --git a/trunk/src/DefaultDiskWriter.cc b/trunk/src/DefaultDiskWriter.cc new file mode 100644 index 00000000..ce7dd752 --- /dev/null +++ b/trunk/src/DefaultDiskWriter.cc @@ -0,0 +1,39 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "DefaultDiskWriter.h" +#include "DlAbortEx.h" +#include <errno.h> + +DefaultDiskWriter::DefaultDiskWriter():AbstractDiskWriter() {} + +DefaultDiskWriter::~DefaultDiskWriter() {} + +void DefaultDiskWriter::initAndOpenFile(string filename) { + createFile(filename); +} + +void DefaultDiskWriter::writeData(const char* data, int len, long long int offset) { + if(offset != lseek(fd, offset, SEEK_SET)) { + throw new DlAbortEx(strerror(errno)); + } + writeDataInternal(data, len); +} diff --git a/trunk/src/DefaultDiskWriter.h b/trunk/src/DefaultDiskWriter.h new file mode 100644 index 00000000..c210f40b --- /dev/null +++ b/trunk/src/DefaultDiskWriter.h @@ -0,0 +1,37 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DEFAULT_DISK_WRITER_H_ +#define _D_DEFAULT_DISK_WRITER_H_ + +#include "AbstractDiskWriter.h" + +class DefaultDiskWriter:public AbstractDiskWriter { +public: + DefaultDiskWriter(); + ~DefaultDiskWriter(); + + void initAndOpenFile(string filename); + + void writeData(const char* data, int len, long long int position); +}; + +#endif // _D_DEFAULT_DISK_WRITER_H_ diff --git a/trunk/src/DiskWriter.h b/trunk/src/DiskWriter.h new file mode 100644 index 00000000..96735882 --- /dev/null +++ b/trunk/src/DiskWriter.h @@ -0,0 +1,69 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DISK_WRITER_H_ +#define _D_DISK_WRITER_H_ + +#include <string> +#include "common.h" + +using namespace std; + +/** + * Interface for writing to a binary stream of bytes. + * + */ +class DiskWriter { +public: + virtual ~DiskWriter() {} + /** + * Creates a file output stream to write to the file with the specified name. + * If the file exists, then it is truncated to 0 length. + * @param filename the file name to be opened. + */ + virtual void initAndOpenFile(string filename) = 0; + + /** + * Closes this output stream. + */ + virtual void closeFile() = 0; + + /** + * Opens a file output stream to write to the file with the specified name. + * If the file doesnot exists, an exception may be throwed. + * + * @param filename the file name to be opened. + */ + virtual void openExistingFile(string filename) = 0; + + /* + * Writes len bytes from data to this binary stream at offset position. + * In case where offset position is not concerned(just write data + * sequencially, for example), those subclasses can ignore the offset value. + * + * @param data the data + * @param len the number of bytes to write + * @param position the offset of this binary stream + */ + virtual void writeData(const char* data, int len, long long int position = 0) = 0; +}; + +#endif // _D_DISK_WRITER_H_ diff --git a/trunk/src/DlAbortEx.h b/trunk/src/DlAbortEx.h new file mode 100644 index 00000000..151e2e60 --- /dev/null +++ b/trunk/src/DlAbortEx.h @@ -0,0 +1,37 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DL_ABORT_EX_H_ +#define _D_DL_ABORT_EX_H_ +#include "Exception.h" + +class DlAbortEx:public Exception { +public: + DlAbortEx():Exception() {} + DlAbortEx(string msg, ...):Exception() { + va_list ap; + va_start(ap, msg); + setMsg(msg, ap); + va_end(ap); + } +}; + +#endif // _D_DL_ABORT_EX_H_ diff --git a/trunk/src/DlRetryEx.h b/trunk/src/DlRetryEx.h new file mode 100644 index 00000000..29bf6f70 --- /dev/null +++ b/trunk/src/DlRetryEx.h @@ -0,0 +1,37 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DL_RETRY_EX_H_ +#define _D_DL_RETRY_EX_H_ +#include "Exception.h" + +class DlRetryEx:public Exception { +public: + DlRetryEx():Exception() {} + DlRetryEx(string msg, ...):Exception() { + va_list ap; + va_start(ap, msg); + setMsg(msg, ap); + va_end(ap); + } +}; + +#endif // _D_DL_RETRY_EX_H_ diff --git a/trunk/src/DownloadCommand.cc b/trunk/src/DownloadCommand.cc new file mode 100644 index 00000000..39391963 --- /dev/null +++ b/trunk/src/DownloadCommand.cc @@ -0,0 +1,86 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "DownloadCommand.h" +#include <sys/time.h> +#include "Util.h" +#include "DlRetryEx.h" +#include "HttpInitiateConnectionCommand.h" +#include "InitiateConnectionCommandFactory.h" +#include "message.h" + +DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) { + AbstractCommand::checkSocketIsReadable = true; +} + +DownloadCommand::~DownloadCommand() {} + +bool DownloadCommand::executeInternal(Segment seg) { + TransferEncoding* te = NULL; + if(transferEncoding.size()) { + te = getTransferEncoding(transferEncoding); + assert(te != NULL); + } + int bufSize = 4096; + char buf[bufSize]; + socket->readData(buf, bufSize); + if(te != NULL) { + int infbufSize = 4096; + char infbuf[infbufSize]; + te->inflate(infbuf, infbufSize, buf, bufSize); + e->diskWriter->writeData(infbuf, infbufSize, seg.sp+seg.ds); + seg.ds += infbufSize; + } else { + e->diskWriter->writeData(buf, bufSize, seg.sp+seg.ds); + seg.ds += bufSize; + } + + if(te != NULL && te->finished() + || te == NULL && seg.ds >= seg.ep-seg.sp+1 + || e->segmentMan->totalSize == 0 && bufSize == 0) { + if(te != NULL) te->end(); + e->logger->info(MSG_DOWNLOAD_COMPLETED, cuid); + seg.ds = seg.ep-seg.sp+1; + seg.finish = true; + e->segmentMan->updateSegment(seg); + // this unit is going to download another segment. + return prepareForNextSegment(); + } else { + e->segmentMan->updateSegment(seg); + e->commands.push(this); + return false; + } + +} + +bool DownloadCommand::prepareForRetry(int wait) { + //req->resetUrl(); + return AbstractCommand::prepareForRetry(wait); +} + +bool DownloadCommand::prepareForNextSegment() { + req->resetUrl(); + if(!e->segmentMan->finished()) { + return AbstractCommand::prepareForRetry(0); + } else { + return true; + } +} diff --git a/trunk/src/DownloadCommand.h b/trunk/src/DownloadCommand.h new file mode 100644 index 00000000..0ea9d680 --- /dev/null +++ b/trunk/src/DownloadCommand.h @@ -0,0 +1,48 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DOWNLOAD_COMMAND_H_ +#define _D_DOWNLOAD_COMMAND_H_ + +#include "AbstractCommand.h" +#include "TransferEncoding.h" +#include <string> + +using namespace std; + +class DownloadCommand : public AbstractCommand { +protected: + bool executeInternal(Segment segment); + + bool prepareForRetry(int wait); + bool prepareForNextSegment(); + +public: + DownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + virtual ~DownloadCommand(); + + virtual TransferEncoding* getTransferEncoding(string transferEncoding) = 0; + + string transferEncoding; + +}; + +#endif // _D_DOWNLOAD_COMMAND_H_ diff --git a/trunk/src/DownloadEngine.cc b/trunk/src/DownloadEngine.cc new file mode 100644 index 00000000..0621e66b --- /dev/null +++ b/trunk/src/DownloadEngine.cc @@ -0,0 +1,163 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "DownloadEngine.h" +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include "DlAbortEx.h" +#include "Util.h" + +using namespace std; + +DownloadEngine::DownloadEngine():noWait(false) {} + +DownloadEngine::~DownloadEngine() { + assert(rsockets.empty()); + assert(wsockets.empty()); +} + +void DownloadEngine::run() { + struct timeval cp = { 0, 0 }; + int speed = 0; + long long int psize = 0; + while(!commands.empty()) { + int max = commands.size(); + for(int i = 0; i < max; i++) { + Command* com = commands.front(); + commands.pop(); + if(com->execute()) { + delete(com); + } + } + if(!noWait && !commands.empty()) { + waitData(); + long long int dlSize = segmentMan->getDownloadedSize(); + + struct timeval now; + gettimeofday(&now, NULL); + if(cp.tv_sec == 0 && cp.tv_usec == 0) { + cp = now; + psize = dlSize; + } else { + long long int elapsed = Util::difftv(now, cp); + if(elapsed >= 500000) { + int nspeed = (int)((dlSize-psize)/(elapsed/1000000.0)); + speed = (nspeed+speed)/2; + cp = now; + psize = dlSize; + cout << "\r "; + cout << "\rProgress " << Util::llitos(dlSize, true) << " Bytes/" << + Util::llitos(segmentMan->totalSize, true) << " Bytes " << + (segmentMan->totalSize == 0 ? 0 : (dlSize*100)/segmentMan->totalSize) << "% " << + speed/1000.0 << "KB/s " << + "(" << commands.size() << " connections)" << flush; + } + } + } + noWait = false; + } + segmentMan->removeIfFinished(); + diskWriter->closeFile(); + if(segmentMan->finished()) { + cout << "\nThe download was complete. <" << segmentMan->getFilePath() << ">" << endl; + } else { + cout << "\nThe download was not complete because of errors. Check the log." << endl; + } +} + +// void DownloadEngine::shortSleep() { +// int wait = rpm == 0 ? 0 : 4096*1000/rpm; +// struct timeval tv; +// int retval; +// tv.tv_sec = 0; +// tv.tv_usec = wait*1000; +// retval = select(0, NULL, NULL, NULL, &tv); +// } + +void DownloadEngine::waitData() { + fd_set rfds; + fd_set wfds; + struct timeval tv; + int retval; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + int max = 0; + for(vector<Socket*>::iterator itr = rsockets.begin(); itr != rsockets.end(); itr++) { + FD_SET((*itr)->getSockfd(), &rfds); + if(max < (*itr)->getSockfd()) { + max = (*itr)->getSockfd(); + } + } + for(vector<Socket*>::iterator itr = wsockets.begin(); itr != wsockets.end(); itr++) { + FD_SET((*itr)->getSockfd(), &wfds); + if(max < (*itr)->getSockfd()) { + max = (*itr)->getSockfd(); + } + } + tv.tv_sec = 1; + tv.tv_usec = 0; + + retval = select(max+1, &rfds, &wfds, NULL, &tv); +} + +bool DownloadEngine::addSocket(vector<Socket*>& sockets, Socket* socket) { + vector<Socket*>::iterator itr = find(sockets.begin(), + sockets.end(), + socket); + if(itr == sockets.end()) { + sockets.push_back(socket); + return true; + } else { + return false; + } +} + +bool DownloadEngine::deleteSocket(vector<Socket*>& sockets, Socket* socket) { + vector<Socket*>::iterator itr = find(sockets.begin(), + sockets.end(), + socket); + if(itr != sockets.end()) { + sockets.erase(itr); + return true; + } else { + return false; + } +} + +bool DownloadEngine::addSocketForReadCheck(Socket* socket) { + return addSocket(rsockets, socket); +} + +bool DownloadEngine::deleteSocketForReadCheck(Socket* socket) { + return deleteSocket(rsockets , socket); +} + +bool DownloadEngine::addSocketForWriteCheck(Socket* socket) { + return addSocket(wsockets, socket); +} + +bool DownloadEngine::deleteSocketForWriteCheck(Socket* socket) { + return deleteSocket(wsockets, socket); +} + diff --git a/trunk/src/DownloadEngine.h b/trunk/src/DownloadEngine.h new file mode 100644 index 00000000..f8eaa97d --- /dev/null +++ b/trunk/src/DownloadEngine.h @@ -0,0 +1,66 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DOWNLOAD_ENGINE_H_ +#define _D_DOWNLOAD_ENGINE_H_ + +#include <queue> +#include <vector> +#include "Command.h" +#include "Socket.h" +#include "SegmentMan.h" +#include "common.h" +#include "Logger.h" +#include "DiskWriter.h" +#include "Option.h" + +using namespace std; + +class DownloadEngine { +private: + void waitData(); + vector<Socket*> rsockets; + vector<Socket*> wsockets; + + bool addSocket(vector<Socket*>& sockets, Socket* socket); + bool deleteSocket(vector<Socket*>& sockets, Socket* socket); +public: + bool noWait; + queue<Command*> commands; + SegmentMan* segmentMan; + DiskWriter* diskWriter; + Logger* logger; + Option* option; + + DownloadEngine(); + ~DownloadEngine(); + + void run(); + + bool addSocketForReadCheck(Socket* socket); + bool deleteSocketForReadCheck(Socket* socket); + bool addSocketForWriteCheck(Socket* socket); + bool deleteSocketForWriteCheck(Socket* socket); + +}; + +#endif // _D_DOWNLOAD_ENGINE_H_ + diff --git a/trunk/src/DownloadMethod.h b/trunk/src/DownloadMethod.h new file mode 100644 index 00000000..40a75c91 --- /dev/null +++ b/trunk/src/DownloadMethod.h @@ -0,0 +1,33 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_DOWNLOAD_METHOD_H_ +#define _D_DOWNLOAD_METHOD_H_ + +#include "Request.h" + +class DownloadMethod { +public: + virtual void sendRequest(Request& request) = 0; + virtual void getDataFragment(char* buffer, int len) = 0; +}; + +#endif // _D_DOWNLOAD_METHOD_H_ diff --git a/trunk/src/Exception.h b/trunk/src/Exception.h new file mode 100644 index 00000000..83b62bce --- /dev/null +++ b/trunk/src/Exception.h @@ -0,0 +1,45 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_EXCEPTION_H_ +#define _D_EXCEPTION_H_ + +#include <string> +#include <stdarg.h> + +using namespace std; + +class Exception { +private: + string msg; +protected: + void setMsg(string msgsrc, va_list ap) { + char buf[256]; + vsnprintf(buf, sizeof(buf), msgsrc.c_str(), ap); + msg = buf; + } +public: + Exception() {} + virtual ~Exception() {} + string getMsg() { return msg; } +}; + +#endif // _D_EXCEPTION_H_ diff --git a/trunk/src/File.cc b/trunk/src/File.cc new file mode 100644 index 00000000..e5dc24e2 --- /dev/null +++ b/trunk/src/File.cc @@ -0,0 +1,64 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "File.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +File::File(string name):name(name) {} + +File::~File() {} + +int File::fillStat(struct stat& fstat) { + return stat(name.c_str(), &fstat); +} + +bool File::exists() { + struct stat fstat; + return fillStat(fstat) == 0; +} + +bool File::isFile() { + struct stat fstat; + if(fillStat(fstat) < 0) { + return false; + } + return S_ISREG(fstat.st_mode) == 1; +} + +bool File::isDir() { + struct stat fstat; + if(fillStat(fstat) < 0) { + return false; + } + return S_ISDIR(fstat.st_mode) == 1; +} + +bool File::remove() { + if(isFile()) { + return unlink(name.c_str()) == 0; + } else if(isDir()) { + return rmdir(name.c_str()) == 0; + } else { + return false; + } +} diff --git a/trunk/src/File.h b/trunk/src/File.h new file mode 100644 index 00000000..51cde9a3 --- /dev/null +++ b/trunk/src/File.h @@ -0,0 +1,62 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_FILE_H_ +#define _D_FILE_H_ + +#include <string> + +using namespace std; + +/** + * Represents file and directory + */ +class File { +private: + string name; + int fillStat(struct stat& fstat); +public: + File(string name); + ~File(); + + /** + * Tests whether the file or directory denoted by name exists. + */ + bool exists(); + + /** + * Tests whether the file denoted by name is a regular file. + */ + bool isFile(); + + /** + * Tests whether the file denoted by name is a directory. + */ + bool isDir(); + + /** + * Deletes the file or directory denoted by name. + * If name denotes a directory, it must be empty in order to delete. + */ + bool remove(); +}; + +#endif // _D_FILE_H_ diff --git a/trunk/src/HttpConnection.cc b/trunk/src/HttpConnection.cc new file mode 100644 index 00000000..b22d9126 --- /dev/null +++ b/trunk/src/HttpConnection.cc @@ -0,0 +1,163 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpConnection.h" +#include "DlAbortEx.h" +#include "DlRetryEx.h" +#include "Util.h" +#include "Base64.h" +#include "message.h" + +HttpConnection::HttpConnection(int cuid, Socket* socket, const Option* op, Logger* logger):cuid(cuid), socket(socket),option(op),logger(logger) {} + +void HttpConnection::sendRequest(const Request* req, const Segment& segment) { + string request = createRequest(req, segment); + logger->info(MSG_SENDING_HTTP_REQUEST, cuid, request.c_str()); + socket->writeData(request.c_str(), request.size()); +} + +void HttpConnection::sendProxyRequest(const Request* req) { + string request = string("CONNECT ")+req->getHost()+":"+Util::llitos(req->getPort())+ + string(" HTTP/1.1\r\n")+ + "Host: "+getHost(req->getHost(), req->getPort())+"\r\n"; + if(useProxyAuth()) { + request += "Proxy-Authorization: Basic "+ + Base64::encode(option->get("http_proxy_user")+":"+option->get("http_proxy_passwd"))+"\r\n"; + } + request += "\r\n"; + logger->info(MSG_SENDING_HTTP_REQUEST, cuid, request.c_str()); + socket->writeData(request.c_str(), request.size()); +} + +string HttpConnection::getHost(const string& host, int port) { + return host+(port == 80 || port == 443 ? "" : ":"+Util::llitos(port)); +} + +string HttpConnection::createRequest(const Request* req, const Segment& segment) { + string request = string("GET ")+ + // some servers cannot permit absolute URI as requet URI. + //req->getCurrentUrl()+ + (req->getDir() == "/" ? "/" : req->getDir()+"/")+req->getFile()+ + string(" HTTP/1.1\r\n")+ + "User-Agent: aria2\r\n"+ + "Connection: close\r\n"+ + "Accept: */*\r\n"+ + "Host: "+getHost(req->getHost(), req->getPort())+"\r\n"+ + "Pragma: no-cache\r\n"+ + "Cache-Control: no-cache\r\n"; + if(segment.sp+segment.ds > 0) { + request += "Range: bytes="+Util::llitos(segment.sp+segment.ds)+"-"+Util::llitos(segment.ep)+"\r\n"; + } + if(option->get("http_auth_scheme") == "BASIC") { + request += "Authorization: Basic "+ + Base64::encode(option->get("http_user")+":"+option->get("http_passwd"))+"\r\n"; + } + if(req->getPreviousUrl().size()) { + request += "Referer: "+req->getPreviousUrl()+"\r\n"; + } + + string cookiesValue; + vector<Cookie> cookies = req->cookieBox->criteriaFind(req->getHost(), req->getDir(), req->getProtocol() == "https" ? true : false); + for(vector<Cookie>::const_iterator itr = cookies.begin(); itr != cookies.end(); itr++) { + cookiesValue += (*itr).toString()+";"; + } + if(cookiesValue.size()) { + request += string("Cookie: ")+cookiesValue+"\r\n"; + } + request += "\r\n"; + return request; +} + +int HttpConnection::receiveResponse(HttpHeader& headers) { + string header; + char* buf = NULL; + try { + // read a line of the header + int bufSize = 256; + // TODO limit iteration count + while(1) { + bufSize += 256; + if(bufSize > 2048) { + throw new DlAbortEx(EX_INVALID_HEADER); + } + buf = new char[bufSize]; + int tbufSize = bufSize-1; + socket->peekData(buf, tbufSize); + if(tbufSize > 0) { + buf[tbufSize] = '\0'; + } + header = buf; + char* p; + if((p = strstr(buf, "\r\n")) == buf) { + throw new DlAbortEx(EX_NO_HEADER); + } + if((p = strstr(buf, "\r\n\r\n")) != NULL) { + *(p+4) = '\0'; + header = buf; + tbufSize = header.size(); + socket->readData(buf, tbufSize); + delete [] buf; + buf = NULL; + break; + } else { + delete [] buf; + buf = NULL; + } + } + } catch(Exception* e) { + if(buf != NULL) { + delete [] buf; + } + throw; + } + // OK, i got all headers. + logger->info(MSG_RECEIVE_RESPONSE, cuid, header.c_str()); + string::size_type p, np; + p = np = 0; + np = header.find("\r\n", p); + if(np == string::npos) { + throw new DlRetryEx(EX_NO_STATUS_HEADER); + } + // check HTTP status value + string status = header.substr(9, 3); + p = np+2; + // retreive status name-value pairs, then push these into map + while((np = header.find("\r\n", p)) != string::npos && np != p) { + string line = header.substr(p, np-p); + p = np+2; + pair<string, string> hp; + Util::split(hp, line, ':'); + HttpHeader::value_type nh(hp.first, hp.second); + headers.insert(nh); + } + // TODO rewrite this using strtoul + return (int)strtol(status.c_str(), NULL, 10); +} + +bool HttpConnection::useProxy() { + return option->defined("http_proxy_enabled") && + option->get("http_proxy_enabled") == "true"; +} + +bool HttpConnection::useProxyAuth() { + return option->defined("http_proxy_auth_enabled") && + option->get("http_proxy_auth_enabled") == "true"; +} diff --git a/trunk/src/HttpConnection.h b/trunk/src/HttpConnection.h new file mode 100644 index 00000000..c918d21d --- /dev/null +++ b/trunk/src/HttpConnection.h @@ -0,0 +1,57 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_CONNECTION_H_ +#define _D_HTTP_CONNECTION_H_ + +#include "SegmentMan.h" +#include "Socket.h" +#include "Request.h" +#include "Option.h" +#include "Logger.h" +#include <map> +#include <string> + +using namespace std; + +typedef multimap<string, string> HttpHeader; + +class HttpConnection { +private: + string getHost(const string& host, int port); + string createRequest(const Request* req, const Segment& segment); + bool useProxy(); + bool useProxyAuth(); + bool useBasicAuth(); + int cuid; + Socket* socket; + const Option* option; + Logger* logger; +public: + + HttpConnection(int cuid, Socket* socket, const Option* op, Logger* logger); + + void sendRequest(const Request* req, const Segment& segment); + void sendProxyRequest(const Request* req); + int receiveResponse(HttpHeader& headers); +}; + +#endif // _D_HTTP_CONNECTION_H_ diff --git a/trunk/src/HttpDownloadCommand.cc b/trunk/src/HttpDownloadCommand.cc new file mode 100644 index 00000000..9583a946 --- /dev/null +++ b/trunk/src/HttpDownloadCommand.cc @@ -0,0 +1,52 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpDownloadCommand.h" +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> +#include <algorithm> +#include "DlRetryEx.h" +#include "HttpRequestCommand.h" +#include "SleepCommand.h" +#include "Util.h" +#include "ChunkedEncoding.h" + +using namespace std; + +HttpDownloadCommand::HttpDownloadCommand(int cuid, Request* req, + DownloadEngine* e, + Socket* socket): + DownloadCommand(cuid, req, e, socket) +{ + ChunkedEncoding* ce = new ChunkedEncoding(); + transferEncodings["chunked"] = ce; +} + +HttpDownloadCommand::~HttpDownloadCommand() { + for(map<string, TransferEncoding*>::iterator itr = transferEncodings.begin(); itr != transferEncodings.end(); itr++) { + delete((*itr).second); + } +} + +TransferEncoding* HttpDownloadCommand::getTransferEncoding(string name) { + return transferEncodings[name]; +} diff --git a/trunk/src/HttpDownloadCommand.h b/trunk/src/HttpDownloadCommand.h new file mode 100644 index 00000000..dbd50fa6 --- /dev/null +++ b/trunk/src/HttpDownloadCommand.h @@ -0,0 +1,51 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_DOWNLOAD_COMMAND_H_ +#define _D_HTTP_DOWNLOAD_COMMAND_H_ + +#include "DownloadCommand.h" +#include "DownloadEngine.h" +#include "Socket.h" +#include "Request.h" +#include "common.h" +#include "TransferEncoding.h" +#include <string> +#include <map> + +using namespace std; + +class HttpDownloadCommand:public DownloadCommand { +private: + map<string, TransferEncoding*> transferEncodings; +public: + int cuid; + + HttpDownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + ~HttpDownloadCommand(); + + TransferEncoding* getTransferEncoding(string transferEncoding); + +}; + +#endif // _D_HTTP_DOWNLOAD_COMMAND_H_ + + diff --git a/trunk/src/HttpInitiateConnectionCommand.cc b/trunk/src/HttpInitiateConnectionCommand.cc new file mode 100644 index 00000000..e94c39c9 --- /dev/null +++ b/trunk/src/HttpInitiateConnectionCommand.cc @@ -0,0 +1,57 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpInitiateConnectionCommand.h" +#include "HttpRequestCommand.h" +#include "HttpProxyRequestCommand.h" +#include "Util.h" +#include "message.h" + +HttpInitiateConnectionCommand::HttpInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e):AbstractCommand(cuid, req, e) {} + +HttpInitiateConnectionCommand::~HttpInitiateConnectionCommand() {} + +bool HttpInitiateConnectionCommand::executeInternal(Segment segment) { + socket = new Socket(); + // socket->establishConnection(...); + Command* command; + if(useProxy()) { + e->logger->info(MSG_CONNECTING_TO_SERVER, cuid, + e->option->get("http_proxy_host").c_str(), + e->option->getAsInt("http_proxy_port")); + socket->establishConnection(e->option->get("http_proxy_host"), + e->option->getAsInt("http_proxy_port")); + command = new HttpProxyRequestCommand(cuid, req, e, socket); + + } else { + e->logger->info(MSG_CONNECTING_TO_SERVER, cuid, req->getHost().c_str(), + req->getPort()); + socket->establishConnection(req->getHost(), req->getPort()); + command = new HttpRequestCommand(cuid, req, e, socket); + } + e->commands.push(command); + return true; +} + +bool HttpInitiateConnectionCommand::useProxy() { + return e->option->defined("http_proxy_enabled") && + e->option->get("http_proxy_enabled") == "true"; +} diff --git a/trunk/src/HttpInitiateConnectionCommand.h b/trunk/src/HttpInitiateConnectionCommand.h new file mode 100644 index 00000000..19cc9bd3 --- /dev/null +++ b/trunk/src/HttpInitiateConnectionCommand.h @@ -0,0 +1,47 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_INITIATE_CONNECTION_COMMAND_H_ +#define _D_HTTP_INITIATE_CONNECTION_COMMAND_H_ + +#include "AbstractCommand.h" + +class HttpInitiateConnectionCommand : public AbstractCommand { +private: + bool useProxy(); +protected: + /** + * Connect to the server. + * This method just send connection request to the server. + * Using nonblocking mode of socket, this funtion returns immediately + * after send connection packet to the server. + * Whether or not the connection is established successfully is + * evaluated by RequestCommand. + */ + bool executeInternal(Segment segment); +public: + HttpInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e); + ~HttpInitiateConnectionCommand(); +}; + +#endif // _D_HTTP_INITIATE_CONNECTION_COMMAND_H_ + + diff --git a/trunk/src/HttpProxyRequestCommand.cc b/trunk/src/HttpProxyRequestCommand.cc new file mode 100644 index 00000000..bbff980a --- /dev/null +++ b/trunk/src/HttpProxyRequestCommand.cc @@ -0,0 +1,42 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpProxyRequestCommand.h" +#include "HttpConnection.h" +#include "HttpProxyResponseCommand.h" + +HttpProxyRequestCommand::HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) { + AbstractCommand::checkSocketIsWritable = true; + e->deleteSocketForReadCheck(socket); + e->addSocketForWriteCheck(socket); +} + +HttpProxyRequestCommand::~HttpProxyRequestCommand() {} + +bool HttpProxyRequestCommand::executeInternal(Segment segment) { + socket->setNonBlockingMode(); + HttpConnection httpConnection(cuid, socket, e->option, e->logger); + httpConnection.sendProxyRequest(req); + + HttpProxyResponseCommand* command = new HttpProxyResponseCommand(cuid, req, e, socket); + e->commands.push(command); + return true; +} diff --git a/trunk/src/HttpProxyRequestCommand.h b/trunk/src/HttpProxyRequestCommand.h new file mode 100644 index 00000000..0fe5ca67 --- /dev/null +++ b/trunk/src/HttpProxyRequestCommand.h @@ -0,0 +1,35 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_PROXY_REQUEST_COMMAND_H_ +#define _D_HTTP_PROXY_REQUEST_COMMAND_H_ + +#include "AbstractCommand.h" + +class HttpProxyRequestCommand : public AbstractCommand { +protected: + bool executeInternal(Segment segment); +public: + HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + ~HttpProxyRequestCommand(); +}; + +#endif // _D_HTTP_PROXY_REQUEST_COMMAND_H_ diff --git a/trunk/src/HttpProxyResponseCommand.cc b/trunk/src/HttpProxyResponseCommand.cc new file mode 100644 index 00000000..e62d3939 --- /dev/null +++ b/trunk/src/HttpProxyResponseCommand.cc @@ -0,0 +1,45 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpProxyResponseCommand.h" +#include "HttpRequestCommand.h" +#include "DlRetryEx.h" +#include "HttpConnection.h" +#include "message.h" + +HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) { + AbstractCommand::checkSocketIsReadable = true; +} + +HttpProxyResponseCommand::~HttpProxyResponseCommand() {} + +bool HttpProxyResponseCommand::executeInternal(Segment segment) { + HttpHeader headers; + HttpConnection httpConnection(cuid, socket, e->option, e->logger); + int status = httpConnection.receiveResponse(headers); + if(status != 200) { + throw new DlRetryEx(EX_PROXY_CONNECTION_FAILED); + } + HttpRequestCommand* command = new HttpRequestCommand(cuid, req, e, socket); + e->commands.push(command); + return true; +} + diff --git a/trunk/src/HttpProxyResponseCommand.h b/trunk/src/HttpProxyResponseCommand.h new file mode 100644 index 00000000..6ff0f2ab --- /dev/null +++ b/trunk/src/HttpProxyResponseCommand.h @@ -0,0 +1,35 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_PROXY_RESPONSE_COMMAND_H_ +#define _D_HTTP_PROXY_RESPONSE_COMMAND_H_ + +#include "AbstractCommand.h" + +class HttpProxyResponseCommand : public AbstractCommand { +protected: + bool executeInternal(Segment segment); +public: + HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + ~HttpProxyResponseCommand(); +}; + +#endif // _D_HTTP_PROXY_RESPONSE_COMMAND_H_ diff --git a/trunk/src/HttpRequestCommand.cc b/trunk/src/HttpRequestCommand.cc new file mode 100644 index 00000000..caa8413a --- /dev/null +++ b/trunk/src/HttpRequestCommand.cc @@ -0,0 +1,50 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpRequestCommand.h" +#include "HttpResponseCommand.h" +#include "HttpInitiateConnectionCommand.h" +#include "Socket.h" +#include "Util.h" +#include "HttpConnection.h" + +HttpRequestCommand::HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) { + AbstractCommand::checkSocketIsWritable = true; + e->deleteSocketForReadCheck(socket); + e->addSocketForWriteCheck(socket); +} + +HttpRequestCommand::~HttpRequestCommand() {} + +bool HttpRequestCommand::executeInternal(Segment seg) { + socket->setNonBlockingMode(); + if(req->getProtocol() == "https") { + socket->initiateSecureConnection(); + } + HttpConnection httpConnection(cuid, socket, e->option, e->logger); + // set seg to request in order to remember the request range + req->seg = seg; + httpConnection.sendRequest(req, seg); + + HttpResponseCommand* command = new HttpResponseCommand(cuid, req, e, socket); + e->commands.push(command); + return true; +} diff --git a/trunk/src/HttpRequestCommand.h b/trunk/src/HttpRequestCommand.h new file mode 100644 index 00000000..2e1b4cef --- /dev/null +++ b/trunk/src/HttpRequestCommand.h @@ -0,0 +1,36 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_REQUEST_COMMAND_H_ +#define _D_HTTP_REQUEST_COMMAND_H_ + +#include "AbstractCommand.h" + +class HttpRequestCommand:public AbstractCommand { +protected: + bool executeInternal(Segment segment); + +public: + HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + ~HttpRequestCommand(); +}; + +#endif // _D_HTTP_REQUEST_COMMAND_H_ diff --git a/trunk/src/HttpResponseCommand.cc b/trunk/src/HttpResponseCommand.cc new file mode 100644 index 00000000..22c7fa71 --- /dev/null +++ b/trunk/src/HttpResponseCommand.cc @@ -0,0 +1,149 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpResponseCommand.h" +#include "DlAbortEx.h" +#include "HttpDownloadCommand.h" +#include "HttpInitiateConnectionCommand.h" +#include "message.h" +#include "Util.h" + +HttpResponseCommand::HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s): + AbstractCommand(cuid, req, e, s) { + AbstractCommand::checkSocketIsReadable = true; +} + +HttpResponseCommand::~HttpResponseCommand() {} + +bool HttpResponseCommand::executeInternal(Segment seg) { + if(SEGMENT_EQUAL(req->seg, seg) == false) { + e->logger->info(MSG_SEGMENT_CHANGED, cuid); + return prepareForRetry(0); + } + HttpHeader headers; + HttpConnection httpConnection(cuid, socket, e->option, e->logger); + int status = httpConnection.receiveResponse(headers); + // check HTTP status number + checkResponse(status, seg); + retrieveCookie(headers); + // check whether Location header exists. If it does, update request object + // with redirected URL. + // then establish a connection to the new host and port + if(headers.count("Location")) { + return handleRedirect((*headers.find("Location")).second, headers); + } + if(!e->segmentMan->downloadStarted) { + string transferEncoding; + headers.find("Transfer-Encoding"); + if(headers.count("Transfer-Encoding")) { + return handleOtherEncoding((*headers.find("Transfer-Encoding")).second, headers); + } else { + return handleDefaultEncoding(headers); + } + } else { + if(req->getFile() != e->segmentMan->filename) { + throw new DlAbortEx(EX_FILENAME_MISMATCH, req->getFile().c_str(), e->segmentMan->filename.c_str()); + } + createHttpDownloadCommand(); + return true; + } +} + +void HttpResponseCommand::checkResponse(int status, const Segment& segment) { + if(!(status < 400 && status >= 300 || + (segment.sp+segment.ds == 0 && status == 200) + || (segment.sp+segment.ds > 0 && status == 206))) { + throw new DlAbortEx(EX_BAD_STATUS, status); + } +} + +bool HttpResponseCommand::handleRedirect(string url, const HttpHeader& headers) { + req->redirectUrl(url); + e->logger->info(MSG_REDIRECT, cuid, url.c_str()); + e->noWait = true; + return prepareForRetry(0); +} + +bool HttpResponseCommand::handleDefaultEncoding(const HttpHeader& headers) { + long long int size; + if(headers.count("Content-Length") == 0) { + size = 0; + } else { + size = STRTOLL((*headers.find("Content-Length")).second.c_str()); + if(size == LONG_LONG_MAX || size == LONG_LONG_MIN) { + throw new DlAbortEx(EX_TOO_LARGE_FILE, size); + } + } + e->segmentMan->isSplittable = !(size == 0); + e->segmentMan->filename = req->getFile(); + e->segmentMan->totalSize = size; + bool segFileExists = e->segmentMan->segmentFileExists(); + e->segmentMan->downloadStarted = true; + if(segFileExists) { + e->segmentMan->load(); + e->diskWriter->openExistingFile(e->segmentMan->getFilePath()); + // send request again to the server with Range header + return prepareForRetry(0); + } else { + Segment seg; + e->segmentMan->getSegment(seg, cuid); + e->diskWriter->initAndOpenFile(e->segmentMan->getFilePath()); + createHttpDownloadCommand(); + return true; + } +} + +bool HttpResponseCommand::handleOtherEncoding(string transferEncoding, const HttpHeader& headers) { + // we ignore content-length when transfer-encoding is set + e->segmentMan->downloadStarted = true; + e->segmentMan->isSplittable = false; + e->segmentMan->filename = req->getFile(); + e->segmentMan->totalSize = 0; + Segment seg; + e->segmentMan->getSegment(seg, cuid); + e->diskWriter->initAndOpenFile(e->segmentMan->getFilePath()); + createHttpDownloadCommand(transferEncoding); + return true; +} + +void HttpResponseCommand::createHttpDownloadCommand(string transferEncoding) { + HttpDownloadCommand* command = new HttpDownloadCommand(cuid, req, e, socket); + TransferEncoding* enc = NULL; + if(transferEncoding.size() && (enc = command->getTransferEncoding(transferEncoding)) == NULL) { + delete(command); + throw new DlAbortEx(EX_TRANSFER_ENCODING_NOT_SUPPORTED, transferEncoding.c_str()); + } else { + if(enc != NULL) { + command->transferEncoding = transferEncoding; + enc->init(); + } + e->commands.push(command); + } +} + +void HttpResponseCommand::retrieveCookie(const HttpHeader& headers) { + for(HttpHeader::const_iterator itr = headers.find("Set-Cookie"); itr != headers.end(); itr++) { + Cookie c; + req->cookieBox->parse(c, (*itr).second); + req->cookieBox->add(c); + } +} + diff --git a/trunk/src/HttpResponseCommand.h b/trunk/src/HttpResponseCommand.h new file mode 100644 index 00000000..8300bdc2 --- /dev/null +++ b/trunk/src/HttpResponseCommand.h @@ -0,0 +1,43 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_HTTP_RESPONSE_COMMAND_H_ +#define _D_HTTP_RESPONSE_COMMAND_H_ + +#include "AbstractCommand.h" +#include "HttpConnection.h" + +class HttpResponseCommand : public AbstractCommand { +private: + void checkResponse(int status, const Segment& segment); + bool handleRedirect(string url, const HttpHeader& headers); + bool handleDefaultEncoding(const HttpHeader& headers); + bool handleOtherEncoding(string transferEncoding, const HttpHeader& headers); + void createHttpDownloadCommand(string transferEncoding = ""); + void retrieveCookie(const HttpHeader& headers); +protected: + bool executeInternal(Segment segment); +public: + HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s); + ~HttpResponseCommand(); +}; + +#endif // _D_HTTP_RESPONSE_COMMAND_H_ diff --git a/trunk/src/InitiateConnectionCommandFactory.cc b/trunk/src/InitiateConnectionCommandFactory.cc new file mode 100644 index 00000000..3ba177bd --- /dev/null +++ b/trunk/src/InitiateConnectionCommandFactory.cc @@ -0,0 +1,37 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "InitiateConnectionCommandFactory.h" +#include "HttpInitiateConnectionCommand.h" + +Command* InitiateConnectionCommandFactory::createInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e) { + if(req->getProtocol() == "http" +#ifdef HAVE_LIBSSL + // for SSL + || req->getProtocol() == "https" +#endif // HAVE_LIBSSL + ) { + return new HttpInitiateConnectionCommand(cuid, req, e); + } else { + // these protocols are not supported yet + return NULL; + } +} diff --git a/trunk/src/InitiateConnectionCommandFactory.h b/trunk/src/InitiateConnectionCommandFactory.h new file mode 100644 index 00000000..dea10ed4 --- /dev/null +++ b/trunk/src/InitiateConnectionCommandFactory.h @@ -0,0 +1,34 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_INITIATE_CONNECTION_COMMAND_FACTORY_H_ +#define _D_INITIATE_CONNECTION_COMMAND_FACTORY_H_ + +#include "Request.h" +#include "DownloadEngine.h" +#include "common.h" + +class InitiateConnectionCommandFactory { +public: + static Command* createInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e); +}; + +#endif // _D_INITIATE_CONNECTION_COMMAND_FACTORY_H_ diff --git a/trunk/src/Logger.h b/trunk/src/Logger.h new file mode 100644 index 00000000..620544ea --- /dev/null +++ b/trunk/src/Logger.h @@ -0,0 +1,40 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_LOGGER_H_ +#define _D_LOGGER_H_ +#include <string> +#include "Exception.h" + +using namespace std; + +class Logger { +public: + virtual ~Logger() {} + virtual void debug(string msg, ...) = 0; + virtual void debug(string msg, Exception* ex, ...) = 0; + virtual void info(string msg, ...) = 0; + virtual void info(string msg, Exception* ex, ...) = 0; + virtual void error(string msg, ...) = 0; + virtual void error(string msg, Exception* ex, ...) = 0; +}; + +#endif // _D_LOGGER_H_ diff --git a/trunk/src/Makefile.am b/trunk/src/Makefile.am new file mode 100644 index 00000000..6b5994ea --- /dev/null +++ b/trunk/src/Makefile.am @@ -0,0 +1,43 @@ +bin_PROGRAMS = aria2c +aria2c_SOURCES = main.cc +SRCS = Socket.cc Socket.h\ + SocketCore.cc SocketCore.h\ + Command.h\ + AbstractCommand.cc AbstractCommand.h\ + InitiateConnectionCommandFactory.cc InitiateConnectionCommandFactory.h\ + DownloadCommand.cc DownloadCommand.h\ + HttpInitiateConnectionCommand.cc HttpInitiateConnectionCommand.h\ + HttpRequestCommand.cc HttpRequestCommand.h\ + HttpResponseCommand.cc HttpResponseCommand.h\ + HttpProxyRequestCommand.cc HttpProxyRequestCommand.h\ + HttpProxyResponseCommand.cc HttpProxyResponseCommand.h\ + HttpDownloadCommand.cc HttpDownloadCommand.h\ + HttpConnection.cc HttpConnection.h\ + SleepCommand.cc SleepCommand.h\ + DownloadEngine.cc DownloadEngine.h\ + Segment.h\ + SegmentMan.cc SegmentMan.h\ + Util.cc Util.h\ + Request.cc Request.h\ + common.h\ + message.h\ + Exception.h\ + DlAbortEx.h\ + DlRetryEx.h\ + Logger.h\ + SimpleLogger.cc SimpleLogger.h\ + TransferEncoding.h\ + ChunkedEncoding.cc ChunkedEncoding.h\ + DiskWriter.h\ + DefaultDiskWriter.cc DefaultDiskWriter.h\ + AbstractDiskWriter.cc AbstractDiskWriter.h\ + File.cc File.h\ + Option.cc Option.h\ + Base64.cc Base64.h\ + CookieBox.cc CookieBox.h +noinst_LIBRARIES = libaria2c.a +libaria2c_a_SOURCES = $(SRCS) +aria2c_LDADD = libaria2c.a +FLAGS = -Wall -D_FILE_OFFSET_BITS=64 +libaria2c_a_CXXFLAGS = $(FLAGS) +aria2c_CXXFLAGS = $(FLAGS) diff --git a/trunk/src/Makefile.in b/trunk/src/Makefile.in new file mode 100644 index 00000000..006717df --- /dev/null +++ b/trunk/src/Makefile.in @@ -0,0 +1,874 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = aria2c$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libaria2c_a_AR = $(AR) $(ARFLAGS) +libaria2c_a_LIBADD = +am__objects_1 = libaria2c_a-Socket.$(OBJEXT) \ + libaria2c_a-SocketCore.$(OBJEXT) \ + libaria2c_a-AbstractCommand.$(OBJEXT) \ + libaria2c_a-InitiateConnectionCommandFactory.$(OBJEXT) \ + libaria2c_a-DownloadCommand.$(OBJEXT) \ + libaria2c_a-HttpInitiateConnectionCommand.$(OBJEXT) \ + libaria2c_a-HttpRequestCommand.$(OBJEXT) \ + libaria2c_a-HttpResponseCommand.$(OBJEXT) \ + libaria2c_a-HttpProxyRequestCommand.$(OBJEXT) \ + libaria2c_a-HttpProxyResponseCommand.$(OBJEXT) \ + libaria2c_a-HttpDownloadCommand.$(OBJEXT) \ + libaria2c_a-HttpConnection.$(OBJEXT) \ + libaria2c_a-SleepCommand.$(OBJEXT) \ + libaria2c_a-DownloadEngine.$(OBJEXT) \ + libaria2c_a-SegmentMan.$(OBJEXT) libaria2c_a-Util.$(OBJEXT) \ + libaria2c_a-Request.$(OBJEXT) \ + libaria2c_a-SimpleLogger.$(OBJEXT) \ + libaria2c_a-ChunkedEncoding.$(OBJEXT) \ + libaria2c_a-DefaultDiskWriter.$(OBJEXT) \ + libaria2c_a-AbstractDiskWriter.$(OBJEXT) \ + libaria2c_a-File.$(OBJEXT) libaria2c_a-Option.$(OBJEXT) \ + libaria2c_a-Base64.$(OBJEXT) libaria2c_a-CookieBox.$(OBJEXT) +am_libaria2c_a_OBJECTS = $(am__objects_1) +libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_aria2c_OBJECTS = aria2c-main.$(OBJEXT) +aria2c_OBJECTS = $(am_aria2c_OBJECTS) +aria2c_DEPENDENCIES = libaria2c.a +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libaria2c_a_SOURCES) $(aria2c_SOURCES) +DIST_SOURCES = $(libaria2c_a_SOURCES) $(aria2c_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ +CPPUNIT_CONFIG = @CPPUNIT_CONFIG@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +aria2c_SOURCES = main.cc +SRCS = Socket.cc Socket.h\ + SocketCore.cc SocketCore.h\ + Command.h\ + AbstractCommand.cc AbstractCommand.h\ + InitiateConnectionCommandFactory.cc InitiateConnectionCommandFactory.h\ + DownloadCommand.cc DownloadCommand.h\ + HttpInitiateConnectionCommand.cc HttpInitiateConnectionCommand.h\ + HttpRequestCommand.cc HttpRequestCommand.h\ + HttpResponseCommand.cc HttpResponseCommand.h\ + HttpProxyRequestCommand.cc HttpProxyRequestCommand.h\ + HttpProxyResponseCommand.cc HttpProxyResponseCommand.h\ + HttpDownloadCommand.cc HttpDownloadCommand.h\ + HttpConnection.cc HttpConnection.h\ + SleepCommand.cc SleepCommand.h\ + DownloadEngine.cc DownloadEngine.h\ + Segment.h\ + SegmentMan.cc SegmentMan.h\ + Util.cc Util.h\ + Request.cc Request.h\ + common.h\ + message.h\ + Exception.h\ + DlAbortEx.h\ + DlRetryEx.h\ + Logger.h\ + SimpleLogger.cc SimpleLogger.h\ + TransferEncoding.h\ + ChunkedEncoding.cc ChunkedEncoding.h\ + DiskWriter.h\ + DefaultDiskWriter.cc DefaultDiskWriter.h\ + AbstractDiskWriter.cc AbstractDiskWriter.h\ + File.cc File.h\ + Option.cc Option.h\ + Base64.cc Base64.h\ + CookieBox.cc CookieBox.h + +noinst_LIBRARIES = libaria2c.a +libaria2c_a_SOURCES = $(SRCS) +aria2c_LDADD = libaria2c.a +FLAGS = -Wall -D_FILE_OFFSET_BITS=64 +libaria2c_a_CXXFLAGS = $(FLAGS) +aria2c_CXXFLAGS = $(FLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libaria2c.a: $(libaria2c_a_OBJECTS) $(libaria2c_a_DEPENDENCIES) + -rm -f libaria2c.a + $(libaria2c_a_AR) libaria2c.a $(libaria2c_a_OBJECTS) $(libaria2c_a_LIBADD) + $(RANLIB) libaria2c.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +aria2c$(EXEEXT): $(aria2c_OBJECTS) $(aria2c_DEPENDENCIES) + @rm -f aria2c$(EXEEXT) + $(CXXLINK) $(aria2c_LDFLAGS) $(aria2c_OBJECTS) $(aria2c_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-AbstractCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-Base64.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-ChunkedEncoding.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-CookieBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-DownloadCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-DownloadEngine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-File.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpConnection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpRequestCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-HttpResponseCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-Option.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-Request.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-SegmentMan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-SimpleLogger.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-SleepCommand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-Socket.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-SocketCore.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaria2c_a-Util.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libaria2c_a-Socket.o: Socket.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Socket.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-Socket.Tpo" -c -o libaria2c_a-Socket.o `test -f 'Socket.cc' || echo '$(srcdir)/'`Socket.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Socket.Tpo" "$(DEPDIR)/libaria2c_a-Socket.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Socket.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Socket.cc' object='libaria2c_a-Socket.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Socket.o `test -f 'Socket.cc' || echo '$(srcdir)/'`Socket.cc + +libaria2c_a-Socket.obj: Socket.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Socket.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-Socket.Tpo" -c -o libaria2c_a-Socket.obj `if test -f 'Socket.cc'; then $(CYGPATH_W) 'Socket.cc'; else $(CYGPATH_W) '$(srcdir)/Socket.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Socket.Tpo" "$(DEPDIR)/libaria2c_a-Socket.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Socket.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Socket.cc' object='libaria2c_a-Socket.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Socket.obj `if test -f 'Socket.cc'; then $(CYGPATH_W) 'Socket.cc'; else $(CYGPATH_W) '$(srcdir)/Socket.cc'; fi` + +libaria2c_a-SocketCore.o: SocketCore.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SocketCore.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-SocketCore.Tpo" -c -o libaria2c_a-SocketCore.o `test -f 'SocketCore.cc' || echo '$(srcdir)/'`SocketCore.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SocketCore.Tpo" "$(DEPDIR)/libaria2c_a-SocketCore.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SocketCore.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SocketCore.cc' object='libaria2c_a-SocketCore.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SocketCore.o `test -f 'SocketCore.cc' || echo '$(srcdir)/'`SocketCore.cc + +libaria2c_a-SocketCore.obj: SocketCore.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SocketCore.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-SocketCore.Tpo" -c -o libaria2c_a-SocketCore.obj `if test -f 'SocketCore.cc'; then $(CYGPATH_W) 'SocketCore.cc'; else $(CYGPATH_W) '$(srcdir)/SocketCore.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SocketCore.Tpo" "$(DEPDIR)/libaria2c_a-SocketCore.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SocketCore.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SocketCore.cc' object='libaria2c_a-SocketCore.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SocketCore.obj `if test -f 'SocketCore.cc'; then $(CYGPATH_W) 'SocketCore.cc'; else $(CYGPATH_W) '$(srcdir)/SocketCore.cc'; fi` + +libaria2c_a-AbstractCommand.o: AbstractCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-AbstractCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo" -c -o libaria2c_a-AbstractCommand.o `test -f 'AbstractCommand.cc' || echo '$(srcdir)/'`AbstractCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo" "$(DEPDIR)/libaria2c_a-AbstractCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AbstractCommand.cc' object='libaria2c_a-AbstractCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-AbstractCommand.o `test -f 'AbstractCommand.cc' || echo '$(srcdir)/'`AbstractCommand.cc + +libaria2c_a-AbstractCommand.obj: AbstractCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-AbstractCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo" -c -o libaria2c_a-AbstractCommand.obj `if test -f 'AbstractCommand.cc'; then $(CYGPATH_W) 'AbstractCommand.cc'; else $(CYGPATH_W) '$(srcdir)/AbstractCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo" "$(DEPDIR)/libaria2c_a-AbstractCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-AbstractCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AbstractCommand.cc' object='libaria2c_a-AbstractCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-AbstractCommand.obj `if test -f 'AbstractCommand.cc'; then $(CYGPATH_W) 'AbstractCommand.cc'; else $(CYGPATH_W) '$(srcdir)/AbstractCommand.cc'; fi` + +libaria2c_a-InitiateConnectionCommandFactory.o: InitiateConnectionCommandFactory.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-InitiateConnectionCommandFactory.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo" -c -o libaria2c_a-InitiateConnectionCommandFactory.o `test -f 'InitiateConnectionCommandFactory.cc' || echo '$(srcdir)/'`InitiateConnectionCommandFactory.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo" "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Po"; else rm -f "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitiateConnectionCommandFactory.cc' object='libaria2c_a-InitiateConnectionCommandFactory.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-InitiateConnectionCommandFactory.o `test -f 'InitiateConnectionCommandFactory.cc' || echo '$(srcdir)/'`InitiateConnectionCommandFactory.cc + +libaria2c_a-InitiateConnectionCommandFactory.obj: InitiateConnectionCommandFactory.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-InitiateConnectionCommandFactory.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo" -c -o libaria2c_a-InitiateConnectionCommandFactory.obj `if test -f 'InitiateConnectionCommandFactory.cc'; then $(CYGPATH_W) 'InitiateConnectionCommandFactory.cc'; else $(CYGPATH_W) '$(srcdir)/InitiateConnectionCommandFactory.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo" "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Po"; else rm -f "$(DEPDIR)/libaria2c_a-InitiateConnectionCommandFactory.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitiateConnectionCommandFactory.cc' object='libaria2c_a-InitiateConnectionCommandFactory.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-InitiateConnectionCommandFactory.obj `if test -f 'InitiateConnectionCommandFactory.cc'; then $(CYGPATH_W) 'InitiateConnectionCommandFactory.cc'; else $(CYGPATH_W) '$(srcdir)/InitiateConnectionCommandFactory.cc'; fi` + +libaria2c_a-DownloadCommand.o: DownloadCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DownloadCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo" -c -o libaria2c_a-DownloadCommand.o `test -f 'DownloadCommand.cc' || echo '$(srcdir)/'`DownloadCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo" "$(DEPDIR)/libaria2c_a-DownloadCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DownloadCommand.cc' object='libaria2c_a-DownloadCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DownloadCommand.o `test -f 'DownloadCommand.cc' || echo '$(srcdir)/'`DownloadCommand.cc + +libaria2c_a-DownloadCommand.obj: DownloadCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DownloadCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo" -c -o libaria2c_a-DownloadCommand.obj `if test -f 'DownloadCommand.cc'; then $(CYGPATH_W) 'DownloadCommand.cc'; else $(CYGPATH_W) '$(srcdir)/DownloadCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo" "$(DEPDIR)/libaria2c_a-DownloadCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DownloadCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DownloadCommand.cc' object='libaria2c_a-DownloadCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DownloadCommand.obj `if test -f 'DownloadCommand.cc'; then $(CYGPATH_W) 'DownloadCommand.cc'; else $(CYGPATH_W) '$(srcdir)/DownloadCommand.cc'; fi` + +libaria2c_a-HttpInitiateConnectionCommand.o: HttpInitiateConnectionCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpInitiateConnectionCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo" -c -o libaria2c_a-HttpInitiateConnectionCommand.o `test -f 'HttpInitiateConnectionCommand.cc' || echo '$(srcdir)/'`HttpInitiateConnectionCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpInitiateConnectionCommand.cc' object='libaria2c_a-HttpInitiateConnectionCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpInitiateConnectionCommand.o `test -f 'HttpInitiateConnectionCommand.cc' || echo '$(srcdir)/'`HttpInitiateConnectionCommand.cc + +libaria2c_a-HttpInitiateConnectionCommand.obj: HttpInitiateConnectionCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpInitiateConnectionCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo" -c -o libaria2c_a-HttpInitiateConnectionCommand.obj `if test -f 'HttpInitiateConnectionCommand.cc'; then $(CYGPATH_W) 'HttpInitiateConnectionCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpInitiateConnectionCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpInitiateConnectionCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpInitiateConnectionCommand.cc' object='libaria2c_a-HttpInitiateConnectionCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpInitiateConnectionCommand.obj `if test -f 'HttpInitiateConnectionCommand.cc'; then $(CYGPATH_W) 'HttpInitiateConnectionCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpInitiateConnectionCommand.cc'; fi` + +libaria2c_a-HttpRequestCommand.o: HttpRequestCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpRequestCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo" -c -o libaria2c_a-HttpRequestCommand.o `test -f 'HttpRequestCommand.cc' || echo '$(srcdir)/'`HttpRequestCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpRequestCommand.cc' object='libaria2c_a-HttpRequestCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpRequestCommand.o `test -f 'HttpRequestCommand.cc' || echo '$(srcdir)/'`HttpRequestCommand.cc + +libaria2c_a-HttpRequestCommand.obj: HttpRequestCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpRequestCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo" -c -o libaria2c_a-HttpRequestCommand.obj `if test -f 'HttpRequestCommand.cc'; then $(CYGPATH_W) 'HttpRequestCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpRequestCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpRequestCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpRequestCommand.cc' object='libaria2c_a-HttpRequestCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpRequestCommand.obj `if test -f 'HttpRequestCommand.cc'; then $(CYGPATH_W) 'HttpRequestCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpRequestCommand.cc'; fi` + +libaria2c_a-HttpResponseCommand.o: HttpResponseCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpResponseCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo" -c -o libaria2c_a-HttpResponseCommand.o `test -f 'HttpResponseCommand.cc' || echo '$(srcdir)/'`HttpResponseCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpResponseCommand.cc' object='libaria2c_a-HttpResponseCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpResponseCommand.o `test -f 'HttpResponseCommand.cc' || echo '$(srcdir)/'`HttpResponseCommand.cc + +libaria2c_a-HttpResponseCommand.obj: HttpResponseCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpResponseCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo" -c -o libaria2c_a-HttpResponseCommand.obj `if test -f 'HttpResponseCommand.cc'; then $(CYGPATH_W) 'HttpResponseCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpResponseCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpResponseCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpResponseCommand.cc' object='libaria2c_a-HttpResponseCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpResponseCommand.obj `if test -f 'HttpResponseCommand.cc'; then $(CYGPATH_W) 'HttpResponseCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpResponseCommand.cc'; fi` + +libaria2c_a-HttpProxyRequestCommand.o: HttpProxyRequestCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpProxyRequestCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo" -c -o libaria2c_a-HttpProxyRequestCommand.o `test -f 'HttpProxyRequestCommand.cc' || echo '$(srcdir)/'`HttpProxyRequestCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpProxyRequestCommand.cc' object='libaria2c_a-HttpProxyRequestCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpProxyRequestCommand.o `test -f 'HttpProxyRequestCommand.cc' || echo '$(srcdir)/'`HttpProxyRequestCommand.cc + +libaria2c_a-HttpProxyRequestCommand.obj: HttpProxyRequestCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpProxyRequestCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo" -c -o libaria2c_a-HttpProxyRequestCommand.obj `if test -f 'HttpProxyRequestCommand.cc'; then $(CYGPATH_W) 'HttpProxyRequestCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpProxyRequestCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpProxyRequestCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpProxyRequestCommand.cc' object='libaria2c_a-HttpProxyRequestCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpProxyRequestCommand.obj `if test -f 'HttpProxyRequestCommand.cc'; then $(CYGPATH_W) 'HttpProxyRequestCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpProxyRequestCommand.cc'; fi` + +libaria2c_a-HttpProxyResponseCommand.o: HttpProxyResponseCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpProxyResponseCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo" -c -o libaria2c_a-HttpProxyResponseCommand.o `test -f 'HttpProxyResponseCommand.cc' || echo '$(srcdir)/'`HttpProxyResponseCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpProxyResponseCommand.cc' object='libaria2c_a-HttpProxyResponseCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpProxyResponseCommand.o `test -f 'HttpProxyResponseCommand.cc' || echo '$(srcdir)/'`HttpProxyResponseCommand.cc + +libaria2c_a-HttpProxyResponseCommand.obj: HttpProxyResponseCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpProxyResponseCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo" -c -o libaria2c_a-HttpProxyResponseCommand.obj `if test -f 'HttpProxyResponseCommand.cc'; then $(CYGPATH_W) 'HttpProxyResponseCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpProxyResponseCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpProxyResponseCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpProxyResponseCommand.cc' object='libaria2c_a-HttpProxyResponseCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpProxyResponseCommand.obj `if test -f 'HttpProxyResponseCommand.cc'; then $(CYGPATH_W) 'HttpProxyResponseCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpProxyResponseCommand.cc'; fi` + +libaria2c_a-HttpDownloadCommand.o: HttpDownloadCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpDownloadCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo" -c -o libaria2c_a-HttpDownloadCommand.o `test -f 'HttpDownloadCommand.cc' || echo '$(srcdir)/'`HttpDownloadCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpDownloadCommand.cc' object='libaria2c_a-HttpDownloadCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpDownloadCommand.o `test -f 'HttpDownloadCommand.cc' || echo '$(srcdir)/'`HttpDownloadCommand.cc + +libaria2c_a-HttpDownloadCommand.obj: HttpDownloadCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpDownloadCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo" -c -o libaria2c_a-HttpDownloadCommand.obj `if test -f 'HttpDownloadCommand.cc'; then $(CYGPATH_W) 'HttpDownloadCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpDownloadCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo" "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpDownloadCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpDownloadCommand.cc' object='libaria2c_a-HttpDownloadCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpDownloadCommand.obj `if test -f 'HttpDownloadCommand.cc'; then $(CYGPATH_W) 'HttpDownloadCommand.cc'; else $(CYGPATH_W) '$(srcdir)/HttpDownloadCommand.cc'; fi` + +libaria2c_a-HttpConnection.o: HttpConnection.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpConnection.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo" -c -o libaria2c_a-HttpConnection.o `test -f 'HttpConnection.cc' || echo '$(srcdir)/'`HttpConnection.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo" "$(DEPDIR)/libaria2c_a-HttpConnection.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpConnection.cc' object='libaria2c_a-HttpConnection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpConnection.o `test -f 'HttpConnection.cc' || echo '$(srcdir)/'`HttpConnection.cc + +libaria2c_a-HttpConnection.obj: HttpConnection.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-HttpConnection.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo" -c -o libaria2c_a-HttpConnection.obj `if test -f 'HttpConnection.cc'; then $(CYGPATH_W) 'HttpConnection.cc'; else $(CYGPATH_W) '$(srcdir)/HttpConnection.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo" "$(DEPDIR)/libaria2c_a-HttpConnection.Po"; else rm -f "$(DEPDIR)/libaria2c_a-HttpConnection.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HttpConnection.cc' object='libaria2c_a-HttpConnection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-HttpConnection.obj `if test -f 'HttpConnection.cc'; then $(CYGPATH_W) 'HttpConnection.cc'; else $(CYGPATH_W) '$(srcdir)/HttpConnection.cc'; fi` + +libaria2c_a-SleepCommand.o: SleepCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SleepCommand.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo" -c -o libaria2c_a-SleepCommand.o `test -f 'SleepCommand.cc' || echo '$(srcdir)/'`SleepCommand.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo" "$(DEPDIR)/libaria2c_a-SleepCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SleepCommand.cc' object='libaria2c_a-SleepCommand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SleepCommand.o `test -f 'SleepCommand.cc' || echo '$(srcdir)/'`SleepCommand.cc + +libaria2c_a-SleepCommand.obj: SleepCommand.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SleepCommand.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo" -c -o libaria2c_a-SleepCommand.obj `if test -f 'SleepCommand.cc'; then $(CYGPATH_W) 'SleepCommand.cc'; else $(CYGPATH_W) '$(srcdir)/SleepCommand.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo" "$(DEPDIR)/libaria2c_a-SleepCommand.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SleepCommand.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SleepCommand.cc' object='libaria2c_a-SleepCommand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SleepCommand.obj `if test -f 'SleepCommand.cc'; then $(CYGPATH_W) 'SleepCommand.cc'; else $(CYGPATH_W) '$(srcdir)/SleepCommand.cc'; fi` + +libaria2c_a-DownloadEngine.o: DownloadEngine.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DownloadEngine.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo" -c -o libaria2c_a-DownloadEngine.o `test -f 'DownloadEngine.cc' || echo '$(srcdir)/'`DownloadEngine.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo" "$(DEPDIR)/libaria2c_a-DownloadEngine.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DownloadEngine.cc' object='libaria2c_a-DownloadEngine.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DownloadEngine.o `test -f 'DownloadEngine.cc' || echo '$(srcdir)/'`DownloadEngine.cc + +libaria2c_a-DownloadEngine.obj: DownloadEngine.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DownloadEngine.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo" -c -o libaria2c_a-DownloadEngine.obj `if test -f 'DownloadEngine.cc'; then $(CYGPATH_W) 'DownloadEngine.cc'; else $(CYGPATH_W) '$(srcdir)/DownloadEngine.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo" "$(DEPDIR)/libaria2c_a-DownloadEngine.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DownloadEngine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DownloadEngine.cc' object='libaria2c_a-DownloadEngine.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DownloadEngine.obj `if test -f 'DownloadEngine.cc'; then $(CYGPATH_W) 'DownloadEngine.cc'; else $(CYGPATH_W) '$(srcdir)/DownloadEngine.cc'; fi` + +libaria2c_a-SegmentMan.o: SegmentMan.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SegmentMan.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo" -c -o libaria2c_a-SegmentMan.o `test -f 'SegmentMan.cc' || echo '$(srcdir)/'`SegmentMan.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo" "$(DEPDIR)/libaria2c_a-SegmentMan.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SegmentMan.cc' object='libaria2c_a-SegmentMan.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SegmentMan.o `test -f 'SegmentMan.cc' || echo '$(srcdir)/'`SegmentMan.cc + +libaria2c_a-SegmentMan.obj: SegmentMan.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SegmentMan.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo" -c -o libaria2c_a-SegmentMan.obj `if test -f 'SegmentMan.cc'; then $(CYGPATH_W) 'SegmentMan.cc'; else $(CYGPATH_W) '$(srcdir)/SegmentMan.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo" "$(DEPDIR)/libaria2c_a-SegmentMan.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SegmentMan.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SegmentMan.cc' object='libaria2c_a-SegmentMan.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SegmentMan.obj `if test -f 'SegmentMan.cc'; then $(CYGPATH_W) 'SegmentMan.cc'; else $(CYGPATH_W) '$(srcdir)/SegmentMan.cc'; fi` + +libaria2c_a-Util.o: Util.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Util.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-Util.Tpo" -c -o libaria2c_a-Util.o `test -f 'Util.cc' || echo '$(srcdir)/'`Util.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Util.Tpo" "$(DEPDIR)/libaria2c_a-Util.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Util.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Util.cc' object='libaria2c_a-Util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Util.o `test -f 'Util.cc' || echo '$(srcdir)/'`Util.cc + +libaria2c_a-Util.obj: Util.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Util.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-Util.Tpo" -c -o libaria2c_a-Util.obj `if test -f 'Util.cc'; then $(CYGPATH_W) 'Util.cc'; else $(CYGPATH_W) '$(srcdir)/Util.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Util.Tpo" "$(DEPDIR)/libaria2c_a-Util.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Util.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Util.cc' object='libaria2c_a-Util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Util.obj `if test -f 'Util.cc'; then $(CYGPATH_W) 'Util.cc'; else $(CYGPATH_W) '$(srcdir)/Util.cc'; fi` + +libaria2c_a-Request.o: Request.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Request.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-Request.Tpo" -c -o libaria2c_a-Request.o `test -f 'Request.cc' || echo '$(srcdir)/'`Request.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Request.Tpo" "$(DEPDIR)/libaria2c_a-Request.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Request.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Request.cc' object='libaria2c_a-Request.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Request.o `test -f 'Request.cc' || echo '$(srcdir)/'`Request.cc + +libaria2c_a-Request.obj: Request.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Request.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-Request.Tpo" -c -o libaria2c_a-Request.obj `if test -f 'Request.cc'; then $(CYGPATH_W) 'Request.cc'; else $(CYGPATH_W) '$(srcdir)/Request.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Request.Tpo" "$(DEPDIR)/libaria2c_a-Request.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Request.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Request.cc' object='libaria2c_a-Request.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Request.obj `if test -f 'Request.cc'; then $(CYGPATH_W) 'Request.cc'; else $(CYGPATH_W) '$(srcdir)/Request.cc'; fi` + +libaria2c_a-SimpleLogger.o: SimpleLogger.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SimpleLogger.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo" -c -o libaria2c_a-SimpleLogger.o `test -f 'SimpleLogger.cc' || echo '$(srcdir)/'`SimpleLogger.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo" "$(DEPDIR)/libaria2c_a-SimpleLogger.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SimpleLogger.cc' object='libaria2c_a-SimpleLogger.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SimpleLogger.o `test -f 'SimpleLogger.cc' || echo '$(srcdir)/'`SimpleLogger.cc + +libaria2c_a-SimpleLogger.obj: SimpleLogger.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-SimpleLogger.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo" -c -o libaria2c_a-SimpleLogger.obj `if test -f 'SimpleLogger.cc'; then $(CYGPATH_W) 'SimpleLogger.cc'; else $(CYGPATH_W) '$(srcdir)/SimpleLogger.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo" "$(DEPDIR)/libaria2c_a-SimpleLogger.Po"; else rm -f "$(DEPDIR)/libaria2c_a-SimpleLogger.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SimpleLogger.cc' object='libaria2c_a-SimpleLogger.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-SimpleLogger.obj `if test -f 'SimpleLogger.cc'; then $(CYGPATH_W) 'SimpleLogger.cc'; else $(CYGPATH_W) '$(srcdir)/SimpleLogger.cc'; fi` + +libaria2c_a-ChunkedEncoding.o: ChunkedEncoding.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-ChunkedEncoding.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo" -c -o libaria2c_a-ChunkedEncoding.o `test -f 'ChunkedEncoding.cc' || echo '$(srcdir)/'`ChunkedEncoding.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo" "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Po"; else rm -f "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ChunkedEncoding.cc' object='libaria2c_a-ChunkedEncoding.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-ChunkedEncoding.o `test -f 'ChunkedEncoding.cc' || echo '$(srcdir)/'`ChunkedEncoding.cc + +libaria2c_a-ChunkedEncoding.obj: ChunkedEncoding.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-ChunkedEncoding.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo" -c -o libaria2c_a-ChunkedEncoding.obj `if test -f 'ChunkedEncoding.cc'; then $(CYGPATH_W) 'ChunkedEncoding.cc'; else $(CYGPATH_W) '$(srcdir)/ChunkedEncoding.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo" "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Po"; else rm -f "$(DEPDIR)/libaria2c_a-ChunkedEncoding.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ChunkedEncoding.cc' object='libaria2c_a-ChunkedEncoding.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-ChunkedEncoding.obj `if test -f 'ChunkedEncoding.cc'; then $(CYGPATH_W) 'ChunkedEncoding.cc'; else $(CYGPATH_W) '$(srcdir)/ChunkedEncoding.cc'; fi` + +libaria2c_a-DefaultDiskWriter.o: DefaultDiskWriter.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DefaultDiskWriter.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo" -c -o libaria2c_a-DefaultDiskWriter.o `test -f 'DefaultDiskWriter.cc' || echo '$(srcdir)/'`DefaultDiskWriter.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo" "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DefaultDiskWriter.cc' object='libaria2c_a-DefaultDiskWriter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DefaultDiskWriter.o `test -f 'DefaultDiskWriter.cc' || echo '$(srcdir)/'`DefaultDiskWriter.cc + +libaria2c_a-DefaultDiskWriter.obj: DefaultDiskWriter.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-DefaultDiskWriter.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo" -c -o libaria2c_a-DefaultDiskWriter.obj `if test -f 'DefaultDiskWriter.cc'; then $(CYGPATH_W) 'DefaultDiskWriter.cc'; else $(CYGPATH_W) '$(srcdir)/DefaultDiskWriter.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo" "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Po"; else rm -f "$(DEPDIR)/libaria2c_a-DefaultDiskWriter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DefaultDiskWriter.cc' object='libaria2c_a-DefaultDiskWriter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-DefaultDiskWriter.obj `if test -f 'DefaultDiskWriter.cc'; then $(CYGPATH_W) 'DefaultDiskWriter.cc'; else $(CYGPATH_W) '$(srcdir)/DefaultDiskWriter.cc'; fi` + +libaria2c_a-AbstractDiskWriter.o: AbstractDiskWriter.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-AbstractDiskWriter.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo" -c -o libaria2c_a-AbstractDiskWriter.o `test -f 'AbstractDiskWriter.cc' || echo '$(srcdir)/'`AbstractDiskWriter.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo" "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Po"; else rm -f "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AbstractDiskWriter.cc' object='libaria2c_a-AbstractDiskWriter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-AbstractDiskWriter.o `test -f 'AbstractDiskWriter.cc' || echo '$(srcdir)/'`AbstractDiskWriter.cc + +libaria2c_a-AbstractDiskWriter.obj: AbstractDiskWriter.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-AbstractDiskWriter.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo" -c -o libaria2c_a-AbstractDiskWriter.obj `if test -f 'AbstractDiskWriter.cc'; then $(CYGPATH_W) 'AbstractDiskWriter.cc'; else $(CYGPATH_W) '$(srcdir)/AbstractDiskWriter.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo" "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Po"; else rm -f "$(DEPDIR)/libaria2c_a-AbstractDiskWriter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AbstractDiskWriter.cc' object='libaria2c_a-AbstractDiskWriter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-AbstractDiskWriter.obj `if test -f 'AbstractDiskWriter.cc'; then $(CYGPATH_W) 'AbstractDiskWriter.cc'; else $(CYGPATH_W) '$(srcdir)/AbstractDiskWriter.cc'; fi` + +libaria2c_a-File.o: File.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-File.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-File.Tpo" -c -o libaria2c_a-File.o `test -f 'File.cc' || echo '$(srcdir)/'`File.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-File.Tpo" "$(DEPDIR)/libaria2c_a-File.Po"; else rm -f "$(DEPDIR)/libaria2c_a-File.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='File.cc' object='libaria2c_a-File.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-File.o `test -f 'File.cc' || echo '$(srcdir)/'`File.cc + +libaria2c_a-File.obj: File.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-File.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-File.Tpo" -c -o libaria2c_a-File.obj `if test -f 'File.cc'; then $(CYGPATH_W) 'File.cc'; else $(CYGPATH_W) '$(srcdir)/File.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-File.Tpo" "$(DEPDIR)/libaria2c_a-File.Po"; else rm -f "$(DEPDIR)/libaria2c_a-File.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='File.cc' object='libaria2c_a-File.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-File.obj `if test -f 'File.cc'; then $(CYGPATH_W) 'File.cc'; else $(CYGPATH_W) '$(srcdir)/File.cc'; fi` + +libaria2c_a-Option.o: Option.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Option.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-Option.Tpo" -c -o libaria2c_a-Option.o `test -f 'Option.cc' || echo '$(srcdir)/'`Option.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Option.Tpo" "$(DEPDIR)/libaria2c_a-Option.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Option.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Option.cc' object='libaria2c_a-Option.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Option.o `test -f 'Option.cc' || echo '$(srcdir)/'`Option.cc + +libaria2c_a-Option.obj: Option.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Option.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-Option.Tpo" -c -o libaria2c_a-Option.obj `if test -f 'Option.cc'; then $(CYGPATH_W) 'Option.cc'; else $(CYGPATH_W) '$(srcdir)/Option.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Option.Tpo" "$(DEPDIR)/libaria2c_a-Option.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Option.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Option.cc' object='libaria2c_a-Option.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Option.obj `if test -f 'Option.cc'; then $(CYGPATH_W) 'Option.cc'; else $(CYGPATH_W) '$(srcdir)/Option.cc'; fi` + +libaria2c_a-Base64.o: Base64.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Base64.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-Base64.Tpo" -c -o libaria2c_a-Base64.o `test -f 'Base64.cc' || echo '$(srcdir)/'`Base64.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Base64.Tpo" "$(DEPDIR)/libaria2c_a-Base64.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Base64.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Base64.cc' object='libaria2c_a-Base64.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Base64.o `test -f 'Base64.cc' || echo '$(srcdir)/'`Base64.cc + +libaria2c_a-Base64.obj: Base64.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-Base64.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-Base64.Tpo" -c -o libaria2c_a-Base64.obj `if test -f 'Base64.cc'; then $(CYGPATH_W) 'Base64.cc'; else $(CYGPATH_W) '$(srcdir)/Base64.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-Base64.Tpo" "$(DEPDIR)/libaria2c_a-Base64.Po"; else rm -f "$(DEPDIR)/libaria2c_a-Base64.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Base64.cc' object='libaria2c_a-Base64.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-Base64.obj `if test -f 'Base64.cc'; then $(CYGPATH_W) 'Base64.cc'; else $(CYGPATH_W) '$(srcdir)/Base64.cc'; fi` + +libaria2c_a-CookieBox.o: CookieBox.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-CookieBox.o -MD -MP -MF "$(DEPDIR)/libaria2c_a-CookieBox.Tpo" -c -o libaria2c_a-CookieBox.o `test -f 'CookieBox.cc' || echo '$(srcdir)/'`CookieBox.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-CookieBox.Tpo" "$(DEPDIR)/libaria2c_a-CookieBox.Po"; else rm -f "$(DEPDIR)/libaria2c_a-CookieBox.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CookieBox.cc' object='libaria2c_a-CookieBox.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-CookieBox.o `test -f 'CookieBox.cc' || echo '$(srcdir)/'`CookieBox.cc + +libaria2c_a-CookieBox.obj: CookieBox.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -MT libaria2c_a-CookieBox.obj -MD -MP -MF "$(DEPDIR)/libaria2c_a-CookieBox.Tpo" -c -o libaria2c_a-CookieBox.obj `if test -f 'CookieBox.cc'; then $(CYGPATH_W) 'CookieBox.cc'; else $(CYGPATH_W) '$(srcdir)/CookieBox.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libaria2c_a-CookieBox.Tpo" "$(DEPDIR)/libaria2c_a-CookieBox.Po"; else rm -f "$(DEPDIR)/libaria2c_a-CookieBox.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CookieBox.cc' object='libaria2c_a-CookieBox.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libaria2c_a_CXXFLAGS) $(CXXFLAGS) -c -o libaria2c_a-CookieBox.obj `if test -f 'CookieBox.cc'; then $(CYGPATH_W) 'CookieBox.cc'; else $(CYGPATH_W) '$(srcdir)/CookieBox.cc'; fi` + +aria2c-main.o: main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-main.o -MD -MP -MF "$(DEPDIR)/aria2c-main.Tpo" -c -o aria2c-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-main.Tpo" "$(DEPDIR)/aria2c-main.Po"; else rm -f "$(DEPDIR)/aria2c-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='aria2c-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc + +aria2c-main.obj: main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-main.obj -MD -MP -MF "$(DEPDIR)/aria2c-main.Tpo" -c -o aria2c-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-main.Tpo" "$(DEPDIR)/aria2c-main.Po"; else rm -f "$(DEPDIR)/aria2c-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='aria2c-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/trunk/src/Option.cc b/trunk/src/Option.cc new file mode 100644 index 00000000..96576b83 --- /dev/null +++ b/trunk/src/Option.cc @@ -0,0 +1,52 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "Option.h" + +Option::Option() {} + +Option::~Option() {} + +void Option::put(const string& name, const string& value) { + table[name] = value; +} + +bool Option::defined(const string& name) const { + return table.count(name) == 1; +} + +string Option::get(const string& name) const { + map<string, string>::const_iterator itr = table.find(name); + if(itr == table.end()) { + return ""; + } else { + return (*itr).second; + } +} + +int Option::getAsInt(const string& name) const { + map<string, string>::const_iterator itr = table.find(name); + if(itr == table.end()) { + return 0; + } else { + return (int)strtol((*itr).second.c_str(), NULL, 10); + } +} diff --git a/trunk/src/Option.h b/trunk/src/Option.h new file mode 100644 index 00000000..fa1e0c67 --- /dev/null +++ b/trunk/src/Option.h @@ -0,0 +1,43 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_OPTION_H_ +#define _D_OPTION_H_ + +#include <string> +#include <map> + +using namespace std; + +class Option { +private: + map<string, string> table; +public: + Option(); + ~Option(); + + void put(const string& name, const string& value); + bool defined(const string& name) const; + string get(const string& name) const; + int getAsInt(const string& name) const; +}; + +#endif // _D_OPTION_H_ diff --git a/trunk/src/PreAllocationDiskWriter.cc b/trunk/src/PreAllocationDiskWriter.cc new file mode 100644 index 00000000..abf87777 --- /dev/null +++ b/trunk/src/PreAllocationDiskWriter.cc @@ -0,0 +1,69 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "PreAllocationDiskWriter.h" +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include "DlAbortEx.h" + +PreAllocationDiskWriter::PreAllocationDiskWriter(unsigned long int size):AbstractDiskWriter(),size(size) {} + +PreAllocationDiskWriter::~PreAllocationDiskWriter() {} + +void PreAllocationDiskWriter::initAndOpenFile(string filename) { + createFile(filename, O_DIRECT); + + int pageSize = getpagesize(); + char* buf; + int size = pageSize*4; + int rt = posix_memalign((void**)&buf, pageSize, size); + if(rt != 0) { + throw new DlAbortEx(strerror(rt)); + } + memset(buf, 0, size); + int x = size/4096; + int r = size%4096; + for(int i = 0; i < x; i++) { + if(write(fd, buf, size) < 0) { + free(buf); + throw new DlAbortEx(strerror(errno)); + } + } + free(buf); + closeFile(); + openExistingFile(filename); + char cbuf[4096]; + memset(cbuf, 0, sizeof(cbuf)); + if(write(fd, cbuf, r) < 0) { + throw new DlAbortEx(strerror(errno)); + } +} + +void PreAllocationDiskWriter::writeData(const char* data, int len, unsigned long int offset) { + int x = lseek(fd, offset, SEEK_SET); + // TODO check the return value of write + writeDataInternal(data, len); +} + diff --git a/trunk/src/PreAllocationDiskWriter.h b/trunk/src/PreAllocationDiskWriter.h new file mode 100644 index 00000000..eca8b996 --- /dev/null +++ b/trunk/src/PreAllocationDiskWriter.h @@ -0,0 +1,40 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_PRE_ALLOCATION_DISK_WRITER_H_ +#define _D_PRE_ALLOCATION_DISK_WRITER_H_ + +#include "AbstractDiskWriter.h" + +class PreAllocationDiskWriter:public AbstractDiskWriter { +private: + unsigned long int size; +public: + PreAllocationDiskWriter(unsigned long int size); + ~PreAllocationDiskWriter(); + + void initAndOpenFile(string filename); + + void writeData(const char* data, int len, unsigned long int position); +}; + +#endif // _D_PRE_ALLOCATION_DISK_WRITER_H_ + diff --git a/trunk/src/Request.cc b/trunk/src/Request.cc new file mode 100644 index 00000000..b87cab1d --- /dev/null +++ b/trunk/src/Request.cc @@ -0,0 +1,116 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "Request.h" +#include "Util.h" + +#define MAX_RETRY_COUNT 5 + +Request::Request():port(0), retryCount(0) { + defaultPorts["http"] = 80; +#ifdef HAVE_LIBSSL + // for SSL + defaultPorts["https"] = 443; +#endif // HAVE_LIBSSL + seg.sp = 0; + seg.ep = 0; + seg.ds = 0; + seg.finish = false; + cookieBox = new CookieBox(); +} + +Request::~Request() {} + +bool Request::setUrl(string url) { + this->url = url; + return parseUrl(url); +} + +bool Request::resetUrl() { + previousUrl = referer; + return setUrl(url); +} + +bool Request::redirectUrl(string url) { + previousUrl = currentUrl; + return parseUrl(url); +} + +bool Request::parseUrl(string url) { + currentUrl = url; + host = ""; + port = 0; + dir = ""; + file = ""; + if(url.find_first_not_of(SAFE_CHARS) != string::npos) { + return false; + } + string::size_type hp = url.find("://"); + if(hp == string::npos) return false; + protocol = url.substr(0, hp); + int defPort; + if((defPort = defaultPorts[protocol]) == 0) { + return false; + } + hp += 3; + if(url.size() <= hp) return false; + string::size_type hep = url.find("/", hp); + if(hep == string::npos) { + hep = url.size(); + } + pair<string, string> hostAndPort; + Util::split(hostAndPort, url.substr(hp, hep-hp), ':'); + host = hostAndPort.first; + if(hostAndPort.second != "") { + // TODO rewrite this using strtoul function. If strtoul fails, + // return false. + port = (int)strtol(hostAndPort.second.c_str(), NULL, 10); + if(!(0 < port && port <= 65535)) { + return false; + } + } else { + // If port is not specified, then we leave it 0. + port = defPort; + } + string::size_type direp = url.find_last_of("/"); + if(direp == string::npos || direp <= hep) { + dir = "/"; + direp = hep; + } else { + dir = url.substr(hep, direp-hep); + } + if(url.size() > direp+1) { + file = url.substr(direp+1); + } + return true; +} + +void Request::resetRetryCount() { + this->retryCount = 0; +} + +void Request::addRetryCount() { + retryCount++; +} + +bool Request::noMoreRetry() { + return retryCount >= MAX_RETRY_COUNT; +} diff --git a/trunk/src/Request.h b/trunk/src/Request.h new file mode 100644 index 00000000..0d9554e6 --- /dev/null +++ b/trunk/src/Request.h @@ -0,0 +1,93 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_REQUEST_H_ +#define _D_REQUEST_H_ +#include <string> +#include <map> +#include <Segment.h> +#include "CookieBox.h" +#include "common.h" + +using namespace std; + +#define SAFE_CHARS "abcdefghijklmnopqrstuvwxyz"\ +"ABCDEFGHIJKLMNOPQRSTUVWXYZ"\ +"0123456789"\ +":/?[]@"\ +"!$&'()*+,;="\ +"-._~"\ +"%" + +class Request { +private: + string url; + string currentUrl; + /** + * URL previously requested to the server. This is used as Referer + */ + string previousUrl; + /** + * URL used as Referer in the initial request + */ + string referer; + string protocol; + string host; + int port; + string dir; + string file; + map<string, int> defaultPorts; + int retryCount; + bool parseUrl(string url); +public: + Segment seg; + CookieBox* cookieBox; +public: + Request(); + virtual ~Request(); + + // Parses URL and sets url, host, port, dir, file fields. + // Returns true if parsing goes successful, otherwise returns false. + bool setUrl(string url); + // Parses URL and sets host, port, dir, file fields. + // url field are not altered by this method. + // Returns true if parsing goes successful, otherwise returns false. + bool redirectUrl(string url); + bool resetUrl(); + void resetRetryCount(); + void addRetryCount(); + int getRetryCount(); + bool noMoreRetry(); + + string getUrl() const { return url; } + string getCurrentUrl() const { return currentUrl; } + string getPreviousUrl() const { return previousUrl; } + void setPreviousUrl(string url) { previousUrl = url; } + string getReferer() const { return referer; } + void setReferer(string url) { referer = previousUrl = url; } + string getProtocol() const { return protocol; } + string getHost() const { return host; } + int getPort() const { return port; } + string getDir() const { return dir; } + string getFile() const { return file;} +}; + +#endif // _D_REQUEST_H_ diff --git a/trunk/src/Segment.h b/trunk/src/Segment.h new file mode 100644 index 00000000..c6c2b36c --- /dev/null +++ b/trunk/src/Segment.h @@ -0,0 +1,45 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SEGMENT_H_ +#define _D_SEGMENT_H_ + +/** + * Segment represents a download segment. + * sp, ep is a offset from a begining of a file. + * Therefore, if a file size is x, then 0 <= sp <= ep <= x-1. + * sp, ep is used in Http Range header. + * e.g. Range: bytes=sp-ep + * ds is downloaded bytes. + * If a download of this segement is complete, finish must be set to true. + */ +typedef struct { + int cuid; + long long int sp; + long long int ep; + long long int ds; + bool finish; +} Segment; + +#define SEGMENT_EQUAL(X, Y) (X.cuid == Y.cuid && X.sp == Y.sp && X.ep == Y.ep && X.ds == Y.ds && X.finish == Y.finish ? true : false) + +#endif // _D_SEGMENT_H_ + diff --git a/trunk/src/SegmentMan.cc b/trunk/src/SegmentMan.cc new file mode 100644 index 00000000..8dca0ba0 --- /dev/null +++ b/trunk/src/SegmentMan.cc @@ -0,0 +1,231 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "SegmentMan.h" +#include "DlAbortEx.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <errno.h> +#include "Util.h" +#include "File.h" +#include "message.h" + +SegmentMan::SegmentMan():totalSize(0),isSplittable(true),downloadStarted(false),dir(".") {} + +SegmentMan::~SegmentMan() {} + +void SegmentMan::unregisterId(int cuid) { + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + if((*itr).cuid == cuid) { + cuid = 0; + } + } +} + +bool SegmentMan::getSegment(Segment& seg, int cuid) { + //Segment s = { 0, 0, 0, false }; + + if(segments.empty()) { + logger->debug("assign new segment { sp = 0, ep = "+(totalSize == 0 ? "0" : Util::llitos(totalSize-1))+" } to cuid "+Util::llitos(cuid)); + //seg = { cuid, 0, totalSize == 0 ? 0 : totalSize-1, 0, false }; + seg.cuid = cuid; + seg.sp = 0; + seg.ep = totalSize == 0 ? 0 : totalSize-1; + seg.ds = 0; + seg.finish = false; + segments.push_back(seg); + return true; + } + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + if((*itr).cuid == cuid && !(*itr).finish) { +// logger->debug("return an existing segment { " +// "sp = "+Util::ulitos((*itr).sp)+", "+ +// "ep = "+Util::ulitos((*itr).ep)+", " +// "ds = "+Util::ulitos((*itr).ds)+" } to "+ +// "cuid "+Util::ulitos((*itr).cuid)); + seg = *itr; + return true; + } + } + if(!isSplittable) { + return false; + } + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + Segment& s = *itr; + if(s.finish) { + continue; + } + if(s.cuid == 0) { + s.cuid = cuid; + seg = s; + return true; + } + } + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + Segment& s = *itr; + if(s.finish) { + continue; + } + if(s.ep-(s.sp+s.ds) > 524288) { + long long int nep = (s.ep-(s.sp+s.ds))/2+(s.sp+s.ds); + //nseg = { cuid, nep+1, s.ep, 0, false }; + seg.cuid = cuid; + seg.sp = nep+1; + seg.ep = s.ep; + seg.ds = 0; + seg.finish = false; + s.ep = nep; + logger->debug("return new segment { " + "sp = "+Util::llitos(seg.sp)+", "+ + "ep = "+Util::llitos(seg.ep)+", " + "ds = "+Util::llitos(seg.ds)+" } to "+ + "cuid "+Util::llitos(cuid)); + logger->debug("update segment { " + "sp = "+Util::llitos(s.sp)+", "+ + "ep = "+Util::llitos(s.ep)+", " + "ds = "+Util::llitos(s.ds)+" } of "+ + "cuid "+Util::llitos(s.cuid)); + segments.push_back(seg); + return true; + } + } + return false; +} + +void SegmentMan::updateSegment(const Segment& segment) { + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + if((*itr).cuid == segment.cuid && + (*itr).sp == segment.sp && + (*itr).ep == segment.ep) { + *itr = segment; + break; + } + } +} + + +bool SegmentMan::segmentFileExists() { + if(!isSplittable) { + return false; + } + string segFilename = getSegmentFilePath(); + File f(segFilename); + if(f.isFile()) { + logger->info(MSG_SEGMENT_FILE_EXISTS, segFilename.c_str()); + return true; + } else { + logger->info(MSG_SEGMENT_FILE_DOES_NOT_EXIST, segFilename.c_str()); + return false; + } +} + +void SegmentMan::load() { + if(!isSplittable) { + return; + } + string segFilename = getSegmentFilePath(); + logger->info(MSG_LOADING_SEGMENT_FILE, segFilename.c_str()); + FILE* segFile = openSegFile(segFilename, "r+"); + read(segFile); + fclose(segFile); + logger->info(MSG_LOADED_SEGMENT_FILE); + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); + itr++) { + (*itr).cuid = 0; + } +} + +void SegmentMan::save() { + if(!isSplittable) { + return; + } + string segFilename = getSegmentFilePath(); + logger->info(MSG_SAVING_SEGMENT_FILE, segFilename.c_str()); + FILE* segFile = openSegFile(segFilename, "w"); + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + if(fwrite(&*itr, sizeof(Segment), 1, segFile) < 1) { + throw new DlAbortEx(strerror(errno)); + } + } + fclose(segFile); + logger->info(MSG_SAVED_SEGMENT_FILE); +} + +FILE* SegmentMan::openSegFile(string segFilename, string mode) { + FILE* segFile = fopen(segFilename.c_str(), mode.c_str()); + if(segFile == NULL) { + throw new DlAbortEx(strerror(errno)); + } + return segFile; +} + +void SegmentMan::read(FILE* file) { + assert(file != NULL); + while(1) { + Segment seg; + if(fread(&seg, sizeof(Segment), 1, file) < 1) { + if(ferror(file)) { + throw new DlAbortEx(strerror(errno)); + } else if(feof(file)) { + break; + } + } + segments.push_back(seg); + } +} + +void SegmentMan::remove() { + if(!isSplittable) { + return; + } + if(segmentFileExists()) { + File f(getSegmentFilePath()); + f.remove(); + } +} + +bool SegmentMan::finished() { + if(!downloadStarted || segments.size() == 0) { + return false; + } + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + if(!(*itr).finish) { + return false; + } + } + return true; +} + +void SegmentMan::removeIfFinished() { + if(finished()) { + remove(); + } +} + +long long int SegmentMan::getDownloadedSize() { + long long int size = 0; + for(vector<Segment>::iterator itr = segments.begin(); itr != segments.end(); itr++) { + size += (*itr).ds; + } + return size; +} + diff --git a/trunk/src/SegmentMan.h b/trunk/src/SegmentMan.h new file mode 100644 index 00000000..1ef744e3 --- /dev/null +++ b/trunk/src/SegmentMan.h @@ -0,0 +1,164 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SEGMENT_MAN_H_ +#define _D_SEGMENT_MAN_H_ + +#include <vector> +#include "common.h" +#include "Logger.h" +#include "Segment.h" + +using namespace std; + +#define SEGMENT_FILE_EXTENSION ".aria2" + +/** + * This class holds the download progress of the one download entry. + */ +class SegmentMan { +private: + void read(FILE* file); + FILE* openSegFile(string segFilename, string mode); +public: + /** + * The total number of bytes to download. + * If Transfer-Encoding is Chunked or Content-Length header is not provided, + * then this value is set to be 0. + */ + long long int totalSize; + /** + * Represents whether this download is splittable. + * In Split download(or segmented download), http client establishes + * more than one connections to the server, and downloads sevral parts of + * a file at the same time. This boosts download speed. + * This value is true by default. If total number of bytes is not known or + * Chunked transfer encoding is used, then this value is set to be 0 by + * DownloadCommand class. + */ + bool isSplittable; + /** + * Represents whether the download is start or not. + * The default value is false. + */ + bool downloadStarted; + /** + * Holds segments. + */ + vector<Segment> segments; + /** + * Respresents the file name of the downloaded file. + * If the URL does not contain file name part(http://www.rednoah.com/, for + * example), this value may be 0 length string. + * The default value is 0 length string. + */ + string filename; + /** + * directory to store a file + */ + string dir; + /** + * User defined file name for downloaded content + */ + string ufilename; + + Logger* logger; + + SegmentMan(); + ~SegmentMan(); + + /** + * Returns dir+"/"+filename. + * If filename is empty, then returns dir+"/"+"inex.html"; + */ + string getFilePath() { + return (dir == "" ? "." : dir)+"/"+ + (ufilename == "" ? + (filename == "" ? "index.html" : filename) : ufilename); + } + + string getSegmentFilePath() { + return getFilePath()+SEGMENT_FILE_EXTENSION; + } + + /** + * Sets the cuid of the holded segments with specified cuid to 0. + */ + void unregisterId(int cuid); + /** + * There is a segment available for DownloadCommand specified by cuid, + * fills segment and returns true. + * There is no segment available, then returns false and segment is + * undefined in this case. + * + * @param segment segment to attach for cuid. + * @param cuid cuid of DownloadCommand. + * @returns true: there is a segment available, false: there is no segment + * available. + */ + bool getSegment(Segment& segment, int cuid); + /** + * Updates the ds value of the specified segment. + * Only a segment x is updated where x.sp == sgment.sp && x.ep == + * segment.ep && x.ds == segment.ds &&x.cuid == segment.cuid + * is true. + * + * @param segment segment to update + */ + void updateSegment(const Segment& segment); + /** + * Returns true only if the segment data file exists. + * The file name of the segment data is filename appended by ".aria2". + * If isSplittable is false, then returns simply false without any operation. + */ + bool segmentFileExists(); + /** + * Loads the segment data file. + * If isSplittable is false, then returns without any operation. + */ + void load(); + /** + * Saves the segment data file. + * If isSplittable is false, then returns without any operation. + */ + void save(); + /** + * Removes the segment data file. + * If isSplittable is false, then returns without any operation. + */ + void remove(); + /** + * Returs true when the download has finished. + * If downloadStarted is false or the number of the segments of this object + * holds is 0, then returns false. + */ + bool finished(); + /** + * if finished() is true, then call remove() + */ + void removeIfFinished(); + /** + * Returns the total number of bytes to be downloaded. + */ + long long int getDownloadedSize(); +}; + +#endif // _D_SEGMENT_MAN_H_ diff --git a/trunk/src/SimpleLogger.cc b/trunk/src/SimpleLogger.cc new file mode 100644 index 00000000..9c2b28fe --- /dev/null +++ b/trunk/src/SimpleLogger.cc @@ -0,0 +1,103 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "SimpleLogger.h" +#include <stdarg.h> + +SimpleLogger::SimpleLogger(string filename) { + file = fopen(filename.c_str(), "a"); +} + +SimpleLogger::SimpleLogger(FILE* logfile) { + file = logfile; +} + +SimpleLogger::~SimpleLogger() { + if(file != NULL) { + fclose(file); + } +} + +void SimpleLogger::writeLog(int level, string msg, va_list ap, Exception* e) { + string levelStr; + switch(level) { + case DEBUG: + levelStr = "DEBUG"; + break; + case ERROR: + levelStr = "ERROR"; + break; + case INFO: + default: + levelStr = "INFO"; + } + vfprintf(file, string(levelStr+" - "+msg+"\n").c_str(), ap); + if(e != NULL) { + fprintf(file, string(levelStr+" - exception: "+e->getMsg()+"\n").c_str()); + } + fflush(stdout); +} + +void SimpleLogger::debug(string msg, ...) { + va_list ap; + va_start(ap, msg); + writeLog(DEBUG, msg, ap); + va_end(ap); +} + +void SimpleLogger::debug(string msg, Exception* e, ...) { + va_list ap; + va_start(ap, e); + writeLog(DEBUG, msg, ap, e); + va_end(ap); +} + + +void SimpleLogger::info(string msg, ...) { + va_list ap; + va_start(ap, msg); + writeLog(INFO, msg, ap); + va_end(ap); +} + +void SimpleLogger::info(string msg, Exception* e, ...) { + va_list ap; + va_start(ap, e); + writeLog(INFO, msg, ap, e); + va_end(ap); +} + + +void SimpleLogger::error(string msg, ...) { + va_list ap; + va_start(ap, msg); + writeLog(ERROR, msg, ap); + va_end(ap); +} + +void SimpleLogger::error(string msg, Exception* e, ...) { + va_list ap; + va_start(ap, e); + writeLog(ERROR, msg, ap, e); + va_end(ap); +} + + diff --git a/trunk/src/SimpleLogger.h b/trunk/src/SimpleLogger.h new file mode 100644 index 00000000..4b3843a2 --- /dev/null +++ b/trunk/src/SimpleLogger.h @@ -0,0 +1,49 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SIMPLE_LOGGER_H_ +#define _D_SIMPLE_LOGGER_H_ + +#include "Logger.h" + +class SimpleLogger:public Logger { +private: + enum LEVEL { + DEBUG, + INFO, + ERROR}; + void writeLog(int level, string msg, va_list ap, Exception* e = NULL); + FILE* file; +public: + SimpleLogger(string filename); + SimpleLogger(FILE* logfile); + ~SimpleLogger(); + + void debug(string msg, ...); + void debug(string msg, Exception* ex, ...); + void info(string msg, ...); + void info(string msg, Exception* ex, ...); + void error(string msg, ...); + void error(string msg, Exception* ex, ...); +}; + +#endif // _D_SIMPLE_LOGGER_H_ + diff --git a/trunk/src/SleepCommand.cc b/trunk/src/SleepCommand.cc new file mode 100644 index 00000000..82fc6dc5 --- /dev/null +++ b/trunk/src/SleepCommand.cc @@ -0,0 +1,48 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "SleepCommand.h" +#include "Util.h" + +SleepCommand::SleepCommand(int cuid, DownloadEngine* e, Command* nextCommand, int wait): + Command(cuid), engine(e), nextCommand(nextCommand), wait(wait) { + gettimeofday(&checkPoint, NULL); +} + +SleepCommand::~SleepCommand() { + if(nextCommand != NULL) { + delete(nextCommand); + } +} + +bool SleepCommand::execute() { + struct timeval now; + gettimeofday(&now, NULL); + if(Util::difftv(now, checkPoint) >= wait*1000000) { + engine->commands.push(nextCommand); + nextCommand = NULL; + return true; + } else { + engine->commands.push(this); + return false; + } +} + diff --git a/trunk/src/SleepCommand.h b/trunk/src/SleepCommand.h new file mode 100644 index 00000000..6d75cd86 --- /dev/null +++ b/trunk/src/SleepCommand.h @@ -0,0 +1,41 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SLEEP_COMMAND_H_ +#define _D_SLEEP_COMMAND_H_ + +#include "DownloadEngine.h" +#include "Command.h" +#include <sys/time.h> + +class SleepCommand:public Command { +private: + DownloadEngine* engine; + Command* nextCommand; + int wait; + struct timeval checkPoint; +public: + SleepCommand(int cuid, DownloadEngine* e, Command* nextCommand, int wait); + ~SleepCommand(); + bool execute(); +}; + +#endif // _D_SLEEP_COMMAND_H_ diff --git a/trunk/src/Socket.cc b/trunk/src/Socket.cc new file mode 100644 index 00000000..bf9a04f1 --- /dev/null +++ b/trunk/src/Socket.cc @@ -0,0 +1,86 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "Socket.h" + +Socket::Socket() { + core = new SocketCore(); +} + +Socket::Socket(const Socket& s) { + core = s.core; + core->use++; +} + +Socket::~Socket() { + core->use--; + if(core->use == 0) { + delete core; + } +} + +Socket& Socket::operator=(const Socket& s) { + if(this != &s) { + core->use--; + if(core->use == 0) { + delete core; + } + core = s.core; + core->use++; + } + return *this; +} + +void Socket::establishConnection(string host, int port) { + core->establishConnection(host, port); +} + +void Socket::setNonBlockingMode() { + core->setNonBlockingMode(); +} + +void Socket::closeConnection() { + core->closeConnection(); +} + +bool Socket::isWritable(int timeout) { + return core->isWritable(timeout); +} + +bool Socket::isReadable(int timeout) { + return core->isReadable(timeout); +} + +void Socket::writeData(const char* data, int len, int timeout) { + core->writeData(data, len, timeout); +} + +void Socket::readData(char* data, int& len, int timeout) { + core->readData(data, len, timeout); +} + +void Socket::peekData(char* data, int& len, int timeout) { + core->peekData(data, len, timeout); +} + +void Socket::initiateSecureConnection() { + core->initiateSecureConnection(); +} diff --git a/trunk/src/Socket.h b/trunk/src/Socket.h new file mode 100644 index 00000000..a4624801 --- /dev/null +++ b/trunk/src/Socket.h @@ -0,0 +1,86 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SOCKET_H_ +#define _D_SOCKET_H_ + +#include <string> +#include "SocketCore.h" +#include "common.h" + +using namespace std; + +class Socket { +private: + // socket endpoint descriptor + SocketCore* core; +public: + Socket(); + Socket(const Socket& s); + ~Socket(); + + Socket& operator=(const Socket& s); + + int getSockfd() const { return core->sockfd; } + + /** + * Connects to the server named host and the destination port is port. + * This method make socket non-blocking mode. + * To make the socket blocking mode, call setNonBlockingMode() after + * the connection is established. + */ + void establishConnection(string host, int port); + + void setNonBlockingMode(); + + // Closes the connection which this socket object has + void closeConnection(); + + // examines whether the socket of this Socket object is available for writing. + // returns true if the socket is available for writing, otherwise returns false. + bool isWritable(int timeout); + + // examines whether the socket of this Socket object is available for reading. + // returns true if the socket is available for reading, otherwise returns false. + bool isReadable(int timeout); + + // writes characters into the socket. data is a pointer pointing the first + // byte of the data and len is the length of the data. + void writeData(const char* data, int len, int timeout = 5); + + // Reads up to len bytes from this socket. + // data is a pointer pointing the first + // byte of the data, which must be allocated before this method is called. + // len is the size of the allocated memory. When this method returns + // successfully, len is replaced by the size of the read data. + void readData(char* data, int& len, int timeout = 5); + // Reads up to len bytes from this socket, but bytes are not removed from + // this socket. + void peekData(char* data, int& len, int timeout = 5); + + /** + * Makes this socket secure. + * If the system has not OpenSSL, then this method do nothing. + */ + void initiateSecureConnection(); +}; + +#endif // _D_SOCKET_H_ diff --git a/trunk/src/SocketCore.cc b/trunk/src/SocketCore.cc new file mode 100644 index 00000000..94b986ed --- /dev/null +++ b/trunk/src/SocketCore.cc @@ -0,0 +1,220 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "SocketCore.h" +#include <unistd.h> +#include <fcntl.h> +#include <netdb.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <sys/time.h> +#include <netdb.h> +#include "DlRetryEx.h" +#include "DlAbortEx.h" +#include <errno.h> +#include "message.h" + +SocketCore::SocketCore():sockfd(-1), use(1), secure(false) +#ifdef HAVE_LIBSSL + // for SSL + , sslCtx(NULL), ssl(NULL) +#endif // HAVE_LIBSSL +{} + +SocketCore::~SocketCore() { + closeConnection(); +} + +void SocketCore::establishConnection(string host, int port) { + sockfd = socket(AF_INET, SOCK_STREAM, 0); + if(sockfd >= 0) { + socklen_t sockopt = 1; + if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(int)) < 0) { + close(sockfd); + sockfd = -1; + throw new DlAbortEx(strerror(errno)); + } + } else { + throw new DlAbortEx(strerror(errno)); + } + + struct sockaddr_in sockaddr; + memset((char*)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons(port); + if(inet_aton(host.c_str(), &sockaddr.sin_addr)) { + // ok + } else { + struct addrinfo ai; + ai.ai_flags = 0; + ai.ai_family = PF_INET; + ai.ai_socktype = SOCK_STREAM; + ai.ai_protocol = 0; + ai.ai_addr = (struct sockaddr*)&sockaddr; + struct addrinfo* res; + int ec; + if((ec = getaddrinfo(host.c_str(), NULL, &ai, &res)) != 0) { + throw new DlAbortEx(gai_strerror(ec)); + } + sockaddr.sin_addr = ((struct sockaddr_in*)res->ai_addr)->sin_addr; + freeaddrinfo(res); + } + // make socket non-blocking mode + int flags = fcntl(sockfd, F_GETFL, 0); + fcntl(sockfd, F_SETFL, flags|O_NONBLOCK); + if(connect(sockfd, (struct sockaddr*)&sockaddr, (socklen_t)sizeof(sockaddr)) == -1 && errno != EINPROGRESS) { + throw new DlAbortEx(strerror(errno)); + } +} + +void SocketCore::setNonBlockingMode() { + int flags = fcntl(sockfd, F_GETFL, 0); + fcntl(sockfd, F_SETFL, flags&~O_NONBLOCK); +} + +void SocketCore::closeConnection() { +#ifdef HAVE_LIBSSL + // for SSL + if(secure) { + SSL_shutdown(ssl); + } +#endif // HAVE_LIBSSL + if(sockfd != -1) { + close(sockfd); + sockfd = -1; + } +#ifdef HAVE_LIBSSL + // for SSL + if(secure) { + SSL_free(ssl); + SSL_CTX_free(sslCtx); + ssl = NULL; + sslCtx = NULL; + } +#endif // HAVE_LIBSSL +} + +bool SocketCore::isWritable(int timeout) { + fd_set fds; + FD_ZERO(&fds); + FD_SET(sockfd, &fds); + + struct timeval tv; + tv.tv_sec = timeout; + tv.tv_usec = 0; + + int r = select(sockfd+1, NULL, &fds, NULL, &tv); + if(r == 1) { + return true; + } else if(r == 0) { + // time out + return false; + } else { + throw new DlRetryEx(strerror(errno)); + } +} + +bool SocketCore::isReadable(int timeout) { + fd_set fds; + FD_ZERO(&fds); + FD_SET(sockfd, &fds); + + struct timeval tv; + tv.tv_sec = timeout; + tv.tv_usec = 0; + + int r = select(sockfd+1, &fds, NULL, NULL, &tv); + if(r == 1) { + return true; + } else if(r == 0) { + // time out + return false; + } else { + throw new DlRetryEx(strerror(errno)); + } +} + +void SocketCore::writeData(const char* data, int len, int timeout) { + if(!isWritable(timeout) || + !secure && send(sockfd, data, (size_t)len, 0) != len +#ifdef HAVE_LIBSSL + // for SSL + // TODO handling len == 0 case required + || secure && SSL_write(ssl, data, len) != len +#endif // HAVE_LIBSSL + ) { + throw new DlRetryEx(strerror(errno)); + } +} + +void SocketCore::readData(char* data, int& len, int timeout) { + if(!isReadable(timeout) || + !secure && (len = recv(sockfd, data, (size_t)len, 0)) < 0 +#ifdef HAVE_LIBSSL + // for SSL + // TODO handling len == 0 case required + || secure && (len = SSL_read(ssl, data, len)) < 0 +#endif // HAVE_LIBSSL + ) { + throw new DlRetryEx(strerror(errno)); + } +} + +void SocketCore::peekData(char* data, int& len, int timeout) { + if(!isReadable(timeout) || + !secure && (len = recv(sockfd, data, (size_t)len, MSG_PEEK)) < 0 +#ifdef HAVE_LIBSSL + // for SSL + // TODO handling len == 0 case required + || secure && (len == SSL_peek(ssl, data, len)) < 0 +#endif // HAVE_LIBSSL + ) { + throw new DlRetryEx(strerror(errno)); + } +} + +void SocketCore::initiateSecureConnection() { +#ifdef HAVE_LIBSSL + // for SSL + if(!secure) { + sslCtx = SSL_CTX_new(SSLv23_client_method()); + if(sslCtx == NULL) { + throw new DlAbortEx(EX_SSL_INIT_FAILURE); + } + SSL_CTX_set_mode(sslCtx, SSL_MODE_AUTO_RETRY); + ssl = SSL_new(sslCtx); + if(ssl == NULL) { + throw new DlAbortEx(EX_SSL_INIT_FAILURE); + } + if(SSL_set_fd(ssl, sockfd) == 0) { + throw new DlAbortEx(EX_SSL_INIT_FAILURE); + } + // TODO handling return value == 0 case required + if(SSL_connect(ssl) <= 0) { + throw new DlAbortEx(EX_SSL_INIT_FAILURE); + } + secure = true; + } +#endif // HAVE_LIBSSL +} + diff --git a/trunk/src/SocketCore.h b/trunk/src/SocketCore.h new file mode 100644 index 00000000..ba5fb7af --- /dev/null +++ b/trunk/src/SocketCore.h @@ -0,0 +1,94 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SOCKET_CORE_H_ +#define _D_SOCKET_CORE_H_ + +#include <string> +#include "common.h" + +#ifdef HAVE_LIBSSL +// for SSL +# include <openssl/ssl.h> +#endif // HAVE_LIBSSL + +using namespace std; + +class SocketCore { + friend class Socket; +private: + // socket endpoint descriptor + int sockfd; + // reference counter for this object. + int use; + bool secure; +#ifdef HAVE_LIBSSL + // for SSL + SSL_CTX* sslCtx; + SSL* ssl; +#endif // HAVE_LIBSSL +public: + SocketCore(); + ~SocketCore(); + + /** + * Connects to the server named host and the destination port is port. + * This method make socket non-blocking mode. + * To make the socket blocking mode, call setNonBlockingMode() after + * the connection is established. + */ + void establishConnection(string host, int port); + + void setNonBlockingMode(); + + // Closes the connection which this socket object has + void closeConnection(); + + // examines whether the socket of this SocketCore object is available for writing. + // returns true if the socket is available for writing, otherwise returns false. + bool isWritable(int timeout); + + // examines whether the socket of this SocketCore object is available for reading. + // returns true if the socket is available for reading, otherwise returns false. + bool isReadable(int timeout); + + // writes characters into the socket. data is a pointer pointing the first + // byte of the data and len is the length of the data. + void writeData(const char* data, int len, int timeout = 5); + + // Reads up to len bytes from this socket. + // data is a pointer pointing the first + // byte of the data, which must be allocated before this method is called. + // len is the size of the allocated memory. When this method returns + // successfully, len is replaced by the size of the read data. + void readData(char* data, int& len, int timeout = 5); + // Reads up to len bytes from this socket, but bytes are not removed from + // this socket. + void peekData(char* data, int& len, int timeout = 5); + + /** + * Makes this socket secure. + * If the system has not OpenSSL, then this method do nothing. + */ + void initiateSecureConnection(); +}; + +#endif // _D_SOCKET_CORE_H_ diff --git a/trunk/src/SocketIOException.h b/trunk/src/SocketIOException.h new file mode 100644 index 00000000..10c3df3d --- /dev/null +++ b/trunk/src/SocketIOException.h @@ -0,0 +1,33 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_SOCKET_IO_EXCEPTION_H_ +#define _D_SOCKET_IO_EXCEPTION_H_ + +#include "DlRetryEx.h" + +class SocketIOException:public DlRetryEx { +public: + SocketIOException():DlRetryEx() {}; + SocketIOException(string msg):DlRetryEx(msg) {}; +}; + +#endif // _D_SOCKET_IO_EXCEPTION_H_ diff --git a/trunk/src/TimeoutException.h b/trunk/src/TimeoutException.h new file mode 100644 index 00000000..b1e03483 --- /dev/null +++ b/trunk/src/TimeoutException.h @@ -0,0 +1,36 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_TIMEOUT_EXCEPTION_H_ +#define _D_TIMEOUT_EXCEPTION_H_ + +class TimeoutException { +public: + int err; + string msg; +public: + TimeoutException():err(0), msg("") {}; + TimeoutException(int err):err(err), msg("") {}; + TimeoutException(string msg):err(0), msg(msg) {}; + TimeoutException(int err, string msg):err(err), msg(msg) {} +}; + +#endif // _D_TIMEOUT_EXCEPTION_H_ diff --git a/trunk/src/TransferEncoding.h b/trunk/src/TransferEncoding.h new file mode 100644 index 00000000..41eed716 --- /dev/null +++ b/trunk/src/TransferEncoding.h @@ -0,0 +1,35 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_TRANSFER_ENCODING_H_ +#define _D_TRANSFER_ENCODING_H_ + +class TransferEncoding { +public: + virtual ~TransferEncoding() {} + virtual void init() = 0; + virtual void inflate(char* outbuf, int& outlen, const char* inbuf, int inlen) = 0; + virtual bool finished() = 0; + virtual void end() = 0; +}; + +#endif // _D_TRANSFER_ENCODING_H_ + diff --git a/trunk/src/Util.cc b/trunk/src/Util.cc new file mode 100644 index 00000000..13258e41 --- /dev/null +++ b/trunk/src/Util.cc @@ -0,0 +1,110 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "Util.h" + +string Util::itos(int value, bool comma) { + string str = llitos(value, comma); + return str; +} + +string Util::llitos(long long int value, bool comma) +{ + string str; + bool flag = false; + if(value < 0) { + flag = true; + value = -value; + } else if(value == 0) { + str = "0"; + return str; + } + int count = 0; + while(value) { + ++count; + char digit = value%10+'0'; + str.insert(str.begin(), digit); + value /= 10; + if(comma && count > 3 && count%3 == 1) { + str.insert(str.begin()+1, ','); + } + } + if(flag) { + str.insert(str.begin(), '-'); + } + return str; +} + +string Util::trim(string src) { + string::size_type sp = src.find_first_not_of(" "); + string::size_type ep = src.find_last_not_of(" "); + if(sp == string::npos || ep == string::npos) { + return ""; + } else { + return src.substr(sp, ep-sp+1); + } +} + +void Util::split(pair<string, string>& hp, string src, char delim) { + hp.first = ""; + hp.second = ""; + string::size_type p = src.find(delim); + if(p == string::npos) { + hp.first = src; + hp.second = ""; + } else { + hp.first = trim(src.substr(0, p)); + hp.second = trim(src.substr(p+1)); + /* + unsigned int p2 = src.find_first_not_of(" ", p+1); + if(p2 == string::npos) { + hp.second = ""; + } else { + hp.second = src.substr(p2); + } + */ + } +} + +long long int Util::difftv(struct timeval tv1, struct timeval tv2) { + if(tv1.tv_sec < tv2.tv_sec || tv1.tv_sec == tv2.tv_sec && tv1.tv_usec < tv2.tv_usec) { + return 0; + } + return ((tv1.tv_sec-tv2.tv_sec)*1000000+ + tv1.tv_usec-tv2.tv_usec); +} + +void Util::slice(vector<string>& result, string src, char delim) { + string::size_type p = 0; + while(1) { + string::size_type np = src.find(delim, p); + if(np == string::npos) { + string term = trim(src.substr(p)); + if(term.size() > 0) { + result.push_back(term); + } + break; + } + string term = src.substr(p, np-p); + p = np+1; + result.push_back(trim(term)); + } +} diff --git a/trunk/src/Util.h b/trunk/src/Util.h new file mode 100644 index 00000000..02f73657 --- /dev/null +++ b/trunk/src/Util.h @@ -0,0 +1,54 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_UTIL_H_ +#define _D_UTIL_H_ + +#include <string> +#include <utility> +#include <vector> +#include <sys/time.h> + +using namespace std; + +#define STRTOLL(X) strtoll(X, (char**)NULL, 10); + +class Util { +public: + static void split(pair<string, string>& hp, string src, char delim); + static string llitos(long long int value, bool comma = false); + static string itos(int value, bool comma = false); + /** + * Computes difference in milli second between tv1 and tv2, + * assuming tv1 is newer than tv2. + * If tv1 is older than tv2, then this method returns 0. + */ + static long long int difftv(struct timeval tv1, struct timeval tv2); + /** + * Take a string src which is a deliminated list and add its elements + * into result. result is not cleared before conversion begins. + */ + static void slice(vector<string>& result, string src, char delim); + + static string trim(string src); +}; + +#endif // _D_UTIL_H_ diff --git a/trunk/src/common.h b/trunk/src/common.h new file mode 100644 index 00000000..2ef416fc --- /dev/null +++ b/trunk/src/common.h @@ -0,0 +1,28 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include <iostream> +#include <assert.h> +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +using namespace std; diff --git a/trunk/src/main.cc b/trunk/src/main.cc new file mode 100644 index 00000000..718ddd76 --- /dev/null +++ b/trunk/src/main.cc @@ -0,0 +1,324 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HttpInitiateConnectionCommand.h" +#include "DownloadEngine.h" +#include "SegmentMan.h" +#include "SimpleLogger.h" +#include "common.h" +#include "DefaultDiskWriter.h" +#include "Util.h" +#include "InitiateConnectionCommandFactory.h" +#include <vector> +#include <algorithm> +#include <signal.h> +#include <unistd.h> +#include <libgen.h> +#include <utility> +extern char* optarg; +extern int optind, opterr, optopt; +#include <getopt.h> + +#ifdef HAVE_LIBSSL +// for SSL +# include <openssl/err.h> +# include <openssl/ssl.h> +#endif // HAVE_LIBSSL + +using namespace std; + +void clearRequest(Request* req) { + delete(req); +} + +DownloadEngine* e; + +void handler(int signal) { + cout << "\nSIGINT signal received." << endl; + e->segmentMan->save(); + if(e->diskWriter != NULL) { + e->diskWriter->closeFile(); + } + exit(0); +} + +void addCommand(int cuid, const char* url, string referer, vector<Request*> requests) { + Request* req = new Request(); + req->setReferer(referer); + if(req->setUrl(url)) { + e->commands.push(InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, e)); + requests.push_back(req); + } else { + cerr << "Unrecognized URL or unsupported protocol: " << req->getUrl() << endl; + delete(req); + } +} + +void showVersion() { + cout << PACKAGE_NAME << " version " << PACKAGE_VERSION << endl; + cout << "Copyright (C) 2006 Tatsuhiro Tsujikawa" << endl; + cout << endl; + cout << "This program is free software; you can redistribute it and/or modify" << endl; + cout << "it under the terms of the GNU General Public License as published by" << endl; + cout << "the Free Software Foundation; either version 2 of the License, or" << endl; + cout << "(at your option) any later version." << endl; + cout << endl; + cout << "This program is distributed in the hope that it will be useful," << endl; + cout << "but WITHOUT ANY WARRANTY; without even the implied warranty of" << endl; + cout << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << endl; + cout << "GNU General Public License for more details." << endl; + cout << endl; + cout << "You should have received a copy of the GNU General Public License" << endl; + cout << "along with this program; if not, write to the Free Software" << endl; + cout << "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" << endl; + cout << endl; + cout << "Contact Info: Tasuhiro Tsujikawa <tujikawa at users dot sourceforge dot net>" << endl; + cout << endl; + +} + +void showUsage() { + cout << "Usage: " << PACKAGE_NAME << " [options] URL ..." << endl; + cout << "Options:" << endl; + cout << " -d, --dir=DIR The directory to store downloaded file." << endl; + cout << " -o, --out=FILE The file name for downloaded file." << endl; + cout << " -l, --log=LOG The file path to store log. If '-' is specified," << endl; + cout << " log is written to stdout." << endl; + cout << " -D, --daemon Run as daemon." << endl; + cout << " -s, --split=N Download a file using s connections. s must be" << endl; + cout << " between 1 and 5. If this option is specified the" << endl; + cout << " first URL is used, and the other URLs are ignored." << endl; + cout << " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all" << endl; + cout << " URLs." << endl; + cout << " --http-user=USER Set HTTP user. This affects to all URLs." << endl; + cout << " --http-passwd=PASSWD Set HTTP password. This affects to all URLs." << endl; + cout << " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" << endl; + cout << " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all URLs." << endl; + cout << " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, BASIC" << endl; + cout << " is the only supported scheme. You MUST specify" << endl; + cout << " this option in order to use HTTP authentication" << endl; + cout << " as well as --http-proxy option." << endl; + cout << " --referer Set Referer. This affects to all URLs." << endl; + cout << " --retry-wait Set amount of time in second between requests" << endl; + cout << " for errors. Specify a value between 0 and 60." << endl; + cout << " -v, --version Print the version number and exit." << endl; + cout << " -h, --help Print this message and exit." << endl; + cout << "URL:" << endl; + cout << " You can specify multiple URLs. All URLs must point to the same file" << endl; + cout << " or a download fails." << endl; + cout << "Examples:" << endl; + cout << " Download a file by 1 connection:" << endl; + cout << " aria2c http://AAA.BBB.CCC/file.zip" << endl; + cout << " Download a file by 2 connections:" << endl; + cout << " aria2c -s 2 http://AAA.BBB.CCC/file.zip" << endl; + cout << " Download a file by 2 connections, each connects to a different server." << endl; + cout << " aria2c http://AAA.BBB.CCC/file.zip http://DDD.EEE.FFF/GGG/file.zip" << endl; + cout << "Reports bugs to <tujikawa at rednoah dot com>" << endl; +} + +int main(int argc, char* argv[]) { + bool stdoutLog = false; + string logfile; + string dir; + string ufilename; + int split = 0; + bool daemonMode = false; + string referer; + + int c; + Option* op = new Option(); + op->put("retry_wait", "5"); + + while(1) { + int optIndex = 0; + int lopt; + static struct option longOpts[] = { + { "daemon", no_argument, NULL, 'D' }, + { "dir", required_argument, NULL, 'd' }, + { "out", required_argument, NULL, 'o' }, + { "log", required_argument, NULL, 'l' }, + { "split", required_argument, NULL, 's' }, + { "http-proxy", required_argument, &lopt, 1 }, + { "http-user", required_argument, &lopt, 2 }, + { "http-passwd", required_argument, &lopt, 3 }, + { "http-proxy-user", required_argument, &lopt, 4 }, + { "http-proxy-passwd", required_argument, &lopt, 5 }, + { "http-auth-scheme", required_argument, &lopt, 6 }, + { "referer", required_argument, &lopt, 7 }, + { "retry-wait", required_argument, &lopt, 8 }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, + { 0, 0, 0, 0 } + }; + c = getopt_long(argc, argv, "Dd:o:l:s:vh", longOpts, &optIndex); + if(c == -1) { + break; + } + switch(c) { + case 0:{ + switch(lopt) { + case 1: { + pair<string, string> proxy; + Util::split(proxy, optarg, ':'); + int port = (int)strtol(proxy.second.c_str(), NULL, 10); + if(proxy.first.empty() || proxy.second.empty() || + !(0 < port && port <= 65535)) { + cerr << "unrecognized proxy format" << endl; + showUsage(); + exit(1); + } + op->put("http_proxy_host", proxy.first); + op->put("http_proxy_port", Util::itos(port)); + op->put("http_proxy_enabled", "true"); + break; + } + case 2: + op->put("http_user", optarg); + break; + case 3: + op->put("http_passwd", optarg); + break; + case 4: + op->put("http_proxy_user", optarg); + op->put("http_proxy_auth_enabled", "true"); + break; + case 5: + op->put("http_proxy_passwd", optarg); + break; + case 6: + if(string("BASIC") == optarg) { + op->put("http_auth_scheme", "BASIC"); + } else { + cerr << "Currently, supported authentication scheme is BASIC." << endl; + } + break; + case 7: + referer = optarg; + break; + case 8: { + int wait = (int)strtol(optarg, NULL, 10); + if(!(0 <= wait && wait <= 60)) { + cerr << "retry-wait must be between 0 and 60." << endl; + showUsage(); + exit(1); + } + op->put("retry-wait", Util::itos(wait)); + break; + } + } + break; + } + case 'D': + daemonMode = true; + break; + case 'd': + dir = optarg; + break; + case 'o': + ufilename = optarg; + break; + case 'l': + if(strcmp("-", optarg) == 0) { + stdoutLog = true; + } else { + logfile = optarg; + } + break; + case 's': + split = (int)strtol(optarg, NULL, 10); + if(!(1 < split && split < 5)) { + cerr << "split must be between 1 and 5." << endl; + showUsage(); + exit(1); + } + break; + case 'v': + showVersion(); + exit(0); + case 'h': + showUsage(); + exit(0); + default: + showUsage(); + exit(1); + } + } + if(optind == argc) { + cerr << "specify at least one URL" << endl; + showUsage(); + exit(1); + } + if(daemonMode) { + if(daemon(1, 1) < 0) { + perror("daemon failed"); + exit(1); + } + } +#ifdef HAVE_LIBSSL + // for SSL initialization + SSL_load_error_strings(); + SSL_library_init(); +#endif // HAVE_LIBSSL + SimpleLogger* logger; + if(stdoutLog) { + logger = new SimpleLogger(stdout); + } else if(logfile.size()) { + logger = new SimpleLogger(logfile); + } else { + logger = new SimpleLogger("/dev/null"); + } + + e = new DownloadEngine(); + e->logger = logger; + e->option = op; + e->diskWriter = new DefaultDiskWriter(); + e->segmentMan = new SegmentMan(); + e->segmentMan->dir = dir; + e->segmentMan->ufilename = ufilename; + e->segmentMan->logger = logger; + vector<Request*> requests; + if(split > 0) { + for(int i = 1; i <= split; i++) { + addCommand(i, argv[optind], referer, requests); + } + } else { + for(int i = 1; optind < argc; i++) { + addCommand(i, argv[optind++], referer, requests); + } + } + + struct sigaction sigact; + sigact.sa_handler = handler; + sigact.sa_flags = 0; + sigemptyset(&sigact.sa_mask); + sigaction(SIGINT, &sigact, NULL); + + e->run(); + + for_each(requests.begin(), requests.end(), clearRequest); + requests.clear(); + delete(logger); + delete(e->segmentMan); + delete(e->option); + delete(e->diskWriter); + delete(e); + return 0; +} diff --git a/trunk/src/message.h b/trunk/src/message.h new file mode 100644 index 00000000..445828fa --- /dev/null +++ b/trunk/src/message.h @@ -0,0 +1,55 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#ifndef _D_MESSAGE_H_ +#define _D_MESSAGE_H_ + +#define MSG_DOWNLOAD_COMPLETED "CUID#%d - The download for one segment completed successfully." +#define MSG_NO_SEGMENT_AVAILABLE "CUID#%d - No segment available." +#define MSG_CONNECTING_TO_SERVER "CUID#%d - Connecting to %s:%d" +#define MSG_SEGMENT_CHANGED "CUID#%d - The segment changed. We send the request again with new Range header." +#define MSG_REDIRECT "CUID#%d - Redirecting to %s" +#define MSG_SENDING_HTTP_REQUEST "CUID#%d - Sending the request:\n%s" +#define MSG_RECEIVE_RESPONSE "CUID#%d - Response received:\n%s" +#define MSG_DOWNLOAD_ABORTED "CUID#%d - Download aborted." +#define MSG_RESTARTING_DOWNLOAD "CUID#%d - Restarting the download." +#define MSG_MAX_RETRY "CUID#%d - The retry count reached its max value. Download aborted." + +#define MSG_SEGMENT_FILE_EXISTS "The segment file %s exists." +#define MSG_SEGMENT_FILE_DOES_NOT_EXIST "The segment file %s does not exist." +#define MSG_SAVING_SEGMENT_FILE "Saving the segment file %s" +#define MSG_SAVED_SEGMENT_FILE "The segment file was saved successfully." +#define MSG_LOADING_SEGMENT_FILE "Loading the segment file %s." +#define MSG_LOADED_SEGMENT_FILE "The segment file was loaded successfully." + +#define EX_TIME_OUT "Timeout." +#define EX_INVALID_CHUNK_SIZE "Invalid chunk size." +#define EX_TOO_LARGE_CHUNK "Too large chunk. size = %d" +#define EX_INVALID_HEADER "Invalid header." +#define EX_NO_HEADER "No header found." +#define EX_NO_STATUS_HEADER "No status header." +#define EX_PROXY_CONNECTION_FAILED "Proxy connection failed." +#define EX_FILENAME_MISMATCH "The requested filename and the previously registered one are not same. %s != %s" +#define EX_BAD_STATUS "The response status is not successful. status = %d" +#define EX_TOO_LARGE_FILE "Too large file size. size = %d" +#define EX_TRANSFER_ENCODING_NOT_SUPPORTED "Transfer encoding %s is not supported." +#define EX_SSL_INIT_FAILURE "SSL initialization failed." +#endif // _D_MESSAGE_H_ diff --git a/trunk/src/right.txt b/trunk/src/right.txt new file mode 100644 index 00000000..0d54e187 --- /dev/null +++ b/trunk/src/right.txt @@ -0,0 +1,19 @@ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ |
