mirror of https://github.com/aria2/aria2
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.hpull/1/head
parent
30a378aa57
commit
9a98c71972
|
@ -1,3 +1,11 @@
|
|||
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
|
||||
|
||||
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Added COLON_C(".") and used it in Request::parseUrl()
|
||||
|
|
|
@ -44,6 +44,8 @@ const std::string A2STR::CR_C("\r");
|
|||
|
||||
const std::string A2STR::LF_C("\n");
|
||||
|
||||
const std::string A2STR::CRLF("\r\n");
|
||||
|
||||
const std::string A2STR::SLASH_C("/");
|
||||
|
||||
const std::string A2STR::DOT_C(".");
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
|
||||
static const std::string LF_C;
|
||||
|
||||
static const std::string CRLF;
|
||||
|
||||
static const std::string SLASH_C;
|
||||
|
||||
static const std::string DOT_C;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,6 +61,11 @@ private:
|
|||
unsigned int getStatus(const std::string& response) const;
|
||||
bool isEndOfResponse(unsigned int status, const std::string& response) const;
|
||||
bool bulkReceiveResponse(std::pair<unsigned int, std::string>& response);
|
||||
|
||||
static const std::string A;
|
||||
|
||||
static const std::string I;
|
||||
|
||||
public:
|
||||
FtpConnection(int32_t cuid, const SharedHandle<SocketCore>& socket,
|
||||
const SharedHandle<Request>& req, const Option* op);
|
||||
|
|
Loading…
Reference in New Issue