Rev 1249 | Rev 1308 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1249 | Rev 1284 | ||
---|---|---|---|
Line 348... | Line 348... | ||
348 | /** |
348 | /** |
349 | * Default Constructor. |
349 | * Default Constructor. |
350 | * |
350 | * |
351 | * Connects to an SFTP server |
351 | * Connects to an SFTP server |
352 | * |
352 | * |
- | 353 | * $host can either be a string, representing the host, or a stream resource. |
|
- | 354 | * |
|
353 | * @param string $host |
355 | * @param mixed $host |
354 | * @param int $port |
356 | * @param int $port |
355 | * @param int $timeout |
357 | * @param int $timeout |
356 | */ |
358 | */ |
357 | public function __construct($host, $port = 22, $timeout = 10) |
359 | public function __construct($host, $port = 22, $timeout = 10) |
358 | { |
360 | { |
Line 543... | Line 545... | ||
543 | * @throws \UnexpectedValueException on receipt of unexpected packets |
545 | * @throws \UnexpectedValueException on receipt of unexpected packets |
544 | * @return bool |
546 | * @return bool |
545 | */ |
547 | */ |
546 | private function partial_init_sftp_connection() |
548 | private function partial_init_sftp_connection() |
547 | { |
549 | { |
548 | $this->window_size_server_to_client[self::CHANNEL] = $this->window_size; |
- | |
549 | - | ||
550 | $packet = Strings::packSSH2( |
- | |
551 | 'CsN3', |
- | |
552 | NET_SSH2_MSG_CHANNEL_OPEN, |
- | |
553 | 'session', |
- | |
554 | self::CHANNEL, |
- | |
555 | $this->window_size, |
- | |
556 | 0x4000 |
- | |
557 | ); |
- | |
558 | - | ||
559 | $this->send_binary_packet($packet); |
- | |
560 | - | ||
561 | $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_OPEN; |
- | |
562 | - | ||
563 | $response = $this->get_channel_packet(self::CHANNEL, true); |
550 | $response = $this->openChannel(self::CHANNEL, true); |
564 | if ($response === true && $this->isTimeout()) { |
551 | if ($response === true && $this->isTimeout()) { |
565 | return false; |
552 | return false; |
566 | } |
553 | } |
567 | 554 | ||
568 | $packet = Strings::packSSH2( |
555 | $packet = Strings::packSSH2( |
Line 3420... | Line 3407... | ||
3420 | /** |
3407 | /** |
3421 | * Returns a log of the packets that have been sent and received. |
3408 | * Returns a log of the packets that have been sent and received. |
3422 | * |
3409 | * |
3423 | * Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') |
3410 | * Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') |
3424 | * |
3411 | * |
3425 | * @return array|string |
3412 | * @return array|string|false |
3426 | */ |
3413 | */ |
3427 | public function getSFTPLog() |
3414 | public function getSFTPLog() |
3428 | { |
3415 | { |
3429 | if (!defined('NET_SFTP_LOGGING')) { |
3416 | if (!defined('NET_SFTP_LOGGING')) { |
3430 | return false; |
3417 | return false; |