mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-17 19:36:28 +02:00
Fix A1/A1 Mini FTP by skipping SSL on data channel entirely
The previous fix only skipped SSL session reuse for A1 printers but still wrapped the data channel in SSL. VREmma's testing (issue #31) showed that A1 printers need the data channel to not be SSL-wrapped at all - they timeout waiting for transfer completion responses. The fix: - X1C/P1S: SSL with session reuse on data channel (required by vsFTPd) - A1/A1 Mini: No SSL on data channel (control channel remains encrypted) This matches VREmma's working fix (c723f25) which set ftplib._SSLSocket to None, but implemented properly within the ImplicitFTP_TLS class. Fixes #31 Thanks VREmma!
This commit is contained in:
+3
-3
@@ -30,9 +30,9 @@ All notable changes to Bambuddy will be documented in this file.
|
|||||||
- Applies to: 3MF archiving, print uploads, timelapse downloads, firmware updates
|
- Applies to: 3MF archiving, print uploads, timelapse downloads, firmware updates
|
||||||
- Helps P1S, X1C, and other printers with weak WiFi connections
|
- Helps P1S, X1C, and other printers with weak WiFi connections
|
||||||
- **A1/A1 Mini FTP fix** - Resolved FTP upload failures on A1 series printers:
|
- **A1/A1 Mini FTP fix** - Resolved FTP upload failures on A1 series printers:
|
||||||
- A1 printers don't support SSL session reuse on data connections
|
- A1 printers have issues with SSL on the FTP data channel
|
||||||
- Automatic detection and workaround for A1 and A1 Mini models
|
- Automatic detection skips data channel SSL for A1 and A1 Mini models
|
||||||
- Maintains full encryption while skipping problematic session reuse
|
- Control channel remains encrypted via implicit FTPS (port 990)
|
||||||
- Fixes "read operation timed out" errors during file uploads
|
- Fixes "read operation timed out" errors during file uploads
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ T = TypeVar("T")
|
|||||||
|
|
||||||
|
|
||||||
class ImplicitFTP_TLS(FTP_TLS):
|
class ImplicitFTP_TLS(FTP_TLS):
|
||||||
"""FTP_TLS subclass for implicit FTPS (port 990) with optional session reuse.
|
"""FTP_TLS subclass for implicit FTPS (port 990) with model-specific SSL handling.
|
||||||
|
|
||||||
SSL session reuse is required by X1C/P1S printers (vsFTPd), but causes issues
|
X1C/P1S printers (vsFTPd) require SSL with session reuse on the data channel.
|
||||||
with A1/A1 Mini printers. Set skip_session_reuse=True for A1 printers.
|
A1/A1 Mini printers have issues with SSL on the data channel entirely and
|
||||||
|
timeout waiting for transfer completion. Set skip_session_reuse=True for A1
|
||||||
|
printers to skip SSL on the data channel (control channel remains encrypted).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, skip_session_reuse: bool = False, **kwargs):
|
def __init__(self, *args, skip_session_reuse: bool = False, **kwargs):
|
||||||
@@ -49,27 +51,23 @@ class ImplicitFTP_TLS(FTP_TLS):
|
|||||||
return self.welcome
|
return self.welcome
|
||||||
|
|
||||||
def ntransfercmd(self, cmd, rest=None):
|
def ntransfercmd(self, cmd, rest=None):
|
||||||
"""Override to wrap data connection in SSL.
|
"""Override to wrap data connection in SSL for X1C/P1S only.
|
||||||
|
|
||||||
Session reuse is required by X1C/P1S (vsFTPd) but breaks A1/A1 Mini printers.
|
X1C/P1S printers (vsFTPd) require SSL session reuse on the data channel.
|
||||||
When skip_session_reuse is True, we still encrypt the data channel but
|
A1/A1 Mini printers have issues with SSL on the data channel entirely -
|
||||||
don't reuse the control connection's session.
|
they timeout waiting for the transfer completion response. For A1, we
|
||||||
|
skip SSL wrapping on the data channel (control channel remains encrypted).
|
||||||
"""
|
"""
|
||||||
conn, size = FTP.ntransfercmd(self, cmd, rest)
|
conn, size = FTP.ntransfercmd(self, cmd, rest)
|
||||||
if self._prot_p:
|
if self._prot_p and not self.skip_session_reuse:
|
||||||
if self.skip_session_reuse:
|
# X1C/P1S: Wrap data channel with SSL session reuse (required by vsFTPd)
|
||||||
# A1/A1 Mini: Don't reuse session (causes timeouts/hangs)
|
conn = self.ssl_context.wrap_socket(
|
||||||
conn = self.ssl_context.wrap_socket(
|
conn,
|
||||||
conn,
|
server_hostname=self.host,
|
||||||
server_hostname=self.host,
|
session=self.sock.session,
|
||||||
)
|
)
|
||||||
else:
|
# A1/A1 Mini (skip_session_reuse=True): Don't wrap data channel in SSL
|
||||||
# X1C/P1S: Reuse SSL session (required by vsFTPd)
|
# The control channel remains encrypted via implicit FTPS
|
||||||
conn = self.ssl_context.wrap_socket(
|
|
||||||
conn,
|
|
||||||
server_hostname=self.host,
|
|
||||||
session=self.sock.session,
|
|
||||||
)
|
|
||||||
return conn, size
|
return conn, size
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user