diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-05-14 13:52:47 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-05-14 13:52:47 +0000 |
| commit | 9a98c7197229f4d3ab907c85cdcfb146ad0e5c09 (patch) | |
| tree | eb2e5313f2a4d2047253534ce61befe0af11aafc /src/FtpConnection.cc | |
| parent | 30a378aa57caf55047542f484a0c01982e77f7fd (diff) | |
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Defined "\r\n", "A", "I" as static const std::string
* src/A2STR.cc
* src/A2STR.h
* src/FtpConnection.cc
* src/FtpConnection.h
Diffstat (limited to 'src/FtpConnection.cc')
| -rw-r--r-- | src/FtpConnection.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc index e49906a1..d4cf5f33 100644 --- a/src/FtpConnection.cc +++ b/src/FtpConnection.cc @@ -46,9 +46,14 @@ #include "DlRetryEx.h" #include "DlAbortEx.h" #include "Socket.h" +#include "A2STR.h" namespace aria2 { +const std::string FtpConnection::A("A"); + +const std::string FtpConnection::I("I"); + FtpConnection::FtpConnection(int32_t cuid, const SocketHandle& socket, const RequestHandle& req, const Option* op): cuid(cuid), socket(socket), req(req), option(op), @@ -74,9 +79,9 @@ void FtpConnection::sendType() const { std::string type; if(option->get(PREF_FTP_TYPE) == V_ASCII) { - type = "A"; + type = FtpConnection::A; } else { - type = "I"; + type = FtpConnection::I; } std::string request = "TYPE "+type+"\r\n"; logger->info(MSG_SENDING_REQUEST, cuid, request.c_str()); @@ -99,7 +104,7 @@ void FtpConnection::sendSize() const void FtpConnection::sendPasv() const { - std::string request = "PASV\r\n"; + static const std::string request("PASV\r\n"); logger->info(MSG_SENDING_REQUEST, cuid, request.c_str()); socket->writeData(request); } @@ -170,7 +175,7 @@ bool FtpConnection::isEndOfResponse(unsigned int status, const std::string& resp return false; } } - if(Util::endsWith(response, "\r\n")) { + if(Util::endsWith(response, A2STR::CRLF)) { return true; } else { return false; |
