|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the bee4/transport package. |
|
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
5
|
|
|
* file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Bee4 2015 |
|
8
|
|
|
* @author Stephane HULARD <[email protected]> |
|
9
|
|
|
* @package Bee4\Transport\Message\Request\Ftp |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bee4\Transport\Message\Request\Ftp; |
|
13
|
|
|
|
|
14
|
|
|
use Bee4\Transport\Message\Request\AbstractRequest; |
|
15
|
|
|
|
|
16
|
|
|
class FtpRequest extends AbstractRequest |
|
17
|
|
|
{ |
|
18
|
|
|
//1XX - The requested action is being initiated, expect another reply before proceeding with a new command. |
|
19
|
|
|
//110 -> In this case, the text is exact and not left to the particular implementation; |
|
20
|
|
|
// it must read: STATUS_MARK yyyy = mmmm = where yyyy is User-process data stream marker, |
|
21
|
|
|
// and mmmm server's equivalent marker (note the spaces between markers and \"=\"). |
|
22
|
|
|
const STATUS_110 = "Restart marker replay."; |
|
23
|
|
|
const STATUS_120 = "Service ready in nnn minutes."; |
|
24
|
|
|
const STATUS_125 = "Data connection already open; transfer starting."; |
|
25
|
|
|
const STATUS_150 = "File status okay; about to open data connection."; |
|
26
|
|
|
//2XX - The requested action has been successfully completed. |
|
27
|
|
|
const STATUS_202 = "Command not implemented, superfluous at this site."; |
|
28
|
|
|
const STATUS_211 = "System status, or system help reply."; |
|
29
|
|
|
const STATUS_212 = "Directory status."; |
|
30
|
|
|
const STATUS_213 = "File status."; |
|
31
|
|
|
//214 -> This reply is useful only to the human user. |
|
32
|
|
|
const STATUS_214 = "Help message. On how to use the server or the meaning of a particular non-standard command."; |
|
33
|
|
|
const STATUS_215 = "NAME system type. Where NAME is an official system name from the registry kept by IANA"; |
|
34
|
|
|
const STATUS_220 = "Service ready for new user."; |
|
35
|
|
|
const STATUS_221 = "Service closing control connection."; |
|
36
|
|
|
const STATUS_225 = "Data connection open; no transfer in progress."; |
|
37
|
|
|
//226 -> Requested file action successful (for example, file transfer or file abort)."; |
|
38
|
|
|
const STATUS_226 = "Closing data connection."; |
|
39
|
|
|
const STATUS_227 = "Entering Passive Mode (h1,h2,h3,h4,p1,p2)."; |
|
40
|
|
|
const STATUS_228 = "Entering Long Passive Mode (long address, port)."; |
|
41
|
|
|
const STATUS_229 = "Entering Extended Passive Mode (|||port|)."; |
|
42
|
|
|
const STATUS_230 = "User logged in, proceed. Logged out if appropriate."; |
|
43
|
|
|
const STATUS_231 = "User logged out; service terminated."; |
|
44
|
|
|
const STATUS_232 = "Logout command noted, will complete when transfer done."; |
|
45
|
|
|
const STATUS_250 = "Requested file action okay, completed."; |
|
46
|
|
|
const STATUS_257 = "\"PATHNAME\" created."; |
|
47
|
|
|
//3XX - The command has been accepted, but the requested action is on hold, pending receipt of further information. |
|
48
|
|
|
const STATUS_331 = "User name okay, need password."; |
|
49
|
|
|
const STATUS_332 = "Need account for login."; |
|
50
|
|
|
const STATUS_350 = "Requested file action pending further information"; |
|
51
|
|
|
//4XX - The command was not accepted and the requested action did not take place, |
|
52
|
|
|
// but the error condition is temporary and the action may be requested again. |
|
53
|
|
|
//421 -> This may be a reply to any command if the service knows it must shut down. |
|
54
|
|
|
const STATUS_421 = "Service not available, closing control connection."; |
|
55
|
|
|
const STATUS_425 = "Can't open data connection."; |
|
56
|
|
|
const STATUS_426 = "Connection closed; transfer aborted."; |
|
57
|
|
|
const STATUS_430 = "Invalid username or password"; |
|
58
|
|
|
const STATUS_434 = "Requested host unavailable."; |
|
59
|
|
|
const STATUS_450 = "Requested file action not taken."; |
|
60
|
|
|
const STATUS_451 = "Requested action aborted. Local error in processing."; |
|
61
|
|
|
const STATUS_452 = "Requested action not taken. Insufficient storage space in system. File unavailable."; |
|
62
|
|
|
//5XX - Syntax error, command unrecognized and the requested action did not take place. |
|
63
|
|
|
// This may include errors such as command line too long. |
|
64
|
|
|
const STATUS_501 = "Syntax error in parameters or arguments."; |
|
65
|
|
|
const STATUS_502 = "Command not implemented."; |
|
66
|
|
|
const STATUS_503 = "Bad sequence of commands."; |
|
67
|
|
|
const STATUS_504 = "Command not implemented for that parameter."; |
|
68
|
|
|
const STATUS_530 = "Not logged in."; |
|
69
|
|
|
const STATUS_532 = "Need account for storing files."; |
|
70
|
|
|
const STATUS_550 = "Requested action not taken. File unavailable (e.g., file not found, no access)."; |
|
71
|
|
|
const STATUS_551 = "Requested action aborted. Page type unknown."; |
|
72
|
|
|
const STATUS_552 = "Requested file action aborted. Exceeded storage allocation (for current directory or dataset)."; |
|
73
|
|
|
const STATUS_553 = "Requested action not taken. File name not allowed."; |
|
74
|
|
|
//6XX - Replies regarding confidentiality and integrity |
|
75
|
|
|
const STATUS_631 = "Integrity protected reply."; |
|
76
|
|
|
const STATUS_632 = "Confidentiality and integrity protected reply."; |
|
77
|
|
|
const STATUS_633 = "Confidentiality protected reply."; |
|
78
|
|
|
//100XX - Common Winsock Error Codes |
|
79
|
|
|
const STATUS_10054 = "Connection reset by peer. The connection was forcibly closed by the remote host."; |
|
80
|
|
|
const STATUS_10060 = "Cannot connect to remote server."; |
|
81
|
|
|
const STATUS_10061 = "Cannot connect to remote server. The connection is actively refused by the server."; |
|
82
|
|
|
const STATUS_10066 = "Directory not empty."; |
|
83
|
|
|
const STATUS_10068 = "Too many users, server is full."; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Prepare the request execution by adding specific cURL parameters |
|
87
|
|
|
*/ |
|
88
|
1 |
|
protected function prepare() |
|
89
|
|
|
{ |
|
90
|
|
|
//Force passice mode if not specified |
|
91
|
1 |
|
if (!$this->hasOption(CURLOPT_FTP_USE_EPSV)) { |
|
92
|
1 |
|
$this->addOption(CURLOPT_FTP_USE_EPSV, true); |
|
93
|
1 |
|
} |
|
94
|
|
|
|
|
95
|
|
|
//To make call on different files, we must retrieve the root and apply commands to the path |
|
96
|
1 |
|
$tmp = clone $this->getUrl(); |
|
97
|
1 |
|
$tmp->path(''); |
|
98
|
1 |
|
$this->addOption(CURLOPT_URL, $tmp->toString()); |
|
99
|
1 |
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|