Skip to content

Commit a290097

Browse files
author
Rory Winston
committed
NET-274: Restore socket i/o streams after CCC command
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0@767772 13f79535-47bb-0310-9956-ffa450edef68
1 parent 44cec10 commit a290097

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/org/apache/commons/net/ftp/FTPSClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,16 @@ private boolean checkPROTValue(String prot) {
475475
@Override
476476
public int sendCommand(String command, String args) throws IOException {
477477
int repCode = super.sendCommand(command, args);
478+
/* If CCC is issued, restore socket i/o streams to unsecured versions */
478479
if (FTPSCommand._commands[FTPSCommand.CCC].equals(command)) {
479480
if (FTPReply.COMMAND_OK == repCode) {
480481
_socket_ = plainSocket;
482+
_controlInput_ = new BufferedReader(
483+
new InputStreamReader(
484+
_socket_ .getInputStream(), getControlEncoding()));
485+
_controlOutput_ = new BufferedWriter(
486+
new OutputStreamWriter(
487+
_socket_.getOutputStream(), getControlEncoding()));
481488
setSocketFactory(null);
482489
} else {
483490
throw new SSLException(getReplyString());

0 commit comments

Comments
 (0)