New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

basic-ftp

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-ftp - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

4

CHANGELOG.md
# Changelog
## 1.0.6
- Close sockets on timeout.
## 1.0.5

@@ -4,0 +8,0 @@

27

lib/ftp.js

@@ -48,3 +48,3 @@ "use strict";

if (this._socket) {
// Don't destroy the existing control socket automatically.
// Don't close the existing control socket automatically.
// The setter might have been called to upgrade an existing connection.

@@ -70,6 +70,3 @@ this._socket.removeAllListeners();

set dataSocket(socket) {
if (this._dataSocket) {
this._dataSocket.destroy();
this._dataSocket.removeAllListeners();
}
this._closeSocket(this._dataSocket);
this._dataSocket = this._setupSocket(socket);

@@ -83,3 +80,3 @@ }

get hasTLS() {
return this._socket && this._socket.getSession !== undefined;
return this._socket && this._socket.encrypted === true;
}

@@ -92,4 +89,4 @@

send(command) {
const hasPass = command.indexOf("PASS") !== -1;
const message = hasPass ? "> PASS ###" : `> ${command}`;
// Don't log passwords.
const message = command.startsWith("PASS") ? "> PASS ###" : `> ${command}`;
this.log(message);

@@ -146,5 +143,13 @@ this._socket.write(command + "\r\n");

socket.setTimeout(this._timeoutMillis);
// Reroute any events to the single communication channel with the currently responsible handler.
socket.on("error", error => this._respond({ error }));
socket.on("timeout", () => this._respond({ error: "Timeout" }));
// Reroute any events to the single communication channel with the currently responsible handler.
// In case of an error, the following will happen:
// 1. The current handler should handle the error by at least rejecting the associated task.
// 2. This rejection will then reject the Promise associated with the task.
// 3. This rejected promise will then lead to an exception in the user's application code.
socket.once("error", error => this._respond({ error })); // An error will automatically close a socket.
// Report timeouts as errors.
socket.once("timeout", () => {
socket.destroy(); // A timeout does not automatically close a socket.
this._respond({ error: "Timeout" });
});
}

@@ -151,0 +156,0 @@ return socket;

{
"name": "basic-ftp",
"version": "1.0.5",
"version": "1.0.6",
"description": "FTP/FTPS client library",

@@ -5,0 +5,0 @@ "main": "./lib/ftp",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc