GabriRuflex commented on issue #275:
URL: https://github.com/apache/mina-sshd/issues/275#issuecomment-1330615759
@tomaswolf
If I use the SftpFileSystemProvider there are no issue anymore and the file
upload works properly, thanks!
> ```
> SftpFileSystemProvider provider = new SftpFileSystemProvider(client);
> try (FileSystem fs = provider.newFileSystem(session)) {
> Path remotePath = fs.getPath(remotefilepath);
> try {
> Files.copy(localfileStream, remotePath,
StandardCopyOption.REPLACE_EXISTING);
> } catch (IOException e) {}
> }
> ```
Log:
```
[org.apache.sshd.client.session.ClientSessionImpl]
doHandleMessage(ClientSessionImpl[admin@/10.0.0.1:22]) process #10
SSH_MSG_CHANNEL_DATA
[org.apache.sshd.common.channel.LocalWindow] Consume
LocalWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 13 down to 2097103
[org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem]
handleData(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) SSH_MSG_CHANNEL_DATA
len=13
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
validateIncomingResponse(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]): received
SSH_FXP_STATUS(SSH_FX_NO_SUCH_FILE) for command SSH_FXP_STAT (id=102)
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
throwStatusException(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp])[id=102]
cmd=SSH_FXP_STAT status=SSH_FXP_STATUS[SSH_FX_NO_SUCH_FILE ,language=null
,message=null]
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
open(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]): send SSH_FXP_OPEN
/test.dat
[org.apache.sshd.common.channel.RemoteWindow] Consume
RemoteWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 63 down to 130931
[org.apache.sshd.client.session.ClientSessionImpl]
encode(ClientSessionImpl[admin@/10.0.0.1:22]) packet #11 sending
command=94[SSH_MSG_CHANNEL_DATA] len=72
[org.apache.sshd.common.io.nio2.Nio2Session]
writeBuffer(Nio2Session[local=/127.0.0.1:44642, remote=/10.0.0.1:22]) writing
128 bytes
[org.apache.sshd.client.session.ClientSessionImpl]
doHandleMessage(ClientSessionImpl[admin@/10.0.0.1:22]) process #11
SSH_MSG_CHANNEL_DATA
[org.apache.sshd.common.channel.LocalWindow] Consume
LocalWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 17 down to 2097086
[org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem]
handleData(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) SSH_MSG_CHANNEL_DATA
len=17
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
validateIncomingResponse(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]): received
SSH_FXP_HANDLE for command SSH_FXP_OPEN (id=103)
```
If I use a simple SftpClient with `open` and `handle` functions I still have
issue and I can't upload the file:
> ```
> try (SftpClient sftp =
DefaultSftpClientFactory.INSTANCE.createSftpClient(session)) {
> try (SftpClient.CloseableHandle handle =
sftp.open(remotefilepath, EnumSet.of(SftpClient.OpenMode.Write,
SftpClient.OpenMode.Create))) {
> sftp.write(handle, 0, localfileBytes, 0,
localfileBytes.length);
> } catch (IOException ignored) { }
> } catch (IOException ignored) { }
> } catch (IOException ignored) { }
> } catch (IOException ignored) { }
> }
> ```
Log:
```
[org.apache.sshd.client.session.ClientSessionImpl]
doHandleMessage(ClientSessionImpl[admin@/10.0.0.1:22]) process #8
SSH_MSG_CHANNEL_DATA
[org.apache.sshd.common.channel.LocalWindow] Consume
LocalWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 9 down to 2097143
[org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem]
handleData(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) SSH_MSG_CHANNEL_DATA
len=9
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
negotiateVersion(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) current=3 [3] -> 3
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
open(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]): send SSH_FXP_OPEN
/test.dat
[org.apache.sshd.common.channel.RemoteWindow] Consume
RemoteWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 37 down to 131026
[org.apache.sshd.client.session.ClientSessionImpl]
encode(ClientSessionImpl[admin@/10.0.0.1:22]) packet #9 sending
command=94[SSH_MSG_CHANNEL_DATA] len=46
[org.apache.sshd.common.io.nio2.Nio2Session]
writeBuffer(Nio2Session[local=/127.0.0.1:60194, remote=/10.0.0.1:22]) writing
112 bytes
[org.apache.sshd.client.session.ClientSessionImpl]
doHandleMessage(ClientSessionImpl[admin@/10.0.0.1:22]) process #9
SSH_MSG_CHANNEL_DATA
[org.apache.sshd.common.channel.LocalWindow] Consume
LocalWindow[client](SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) by 13 down to 2097130
[org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem]
handleData(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]) SSH_MSG_CHANNEL_DATA
len=13
[org.apache.sshd.sftp.client.impl.DefaultSftpClient]
validateIncomingResponse(SftpChannelSubsystem[id=0,
recipient=1]-ClientSessionImpl[admin@/10.0.0.1:22][sftp]): received
SSH_FXP_STATUS(SSH_FX_FAILURE) for command SSH_FXP_OPEN (id=101)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]