Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SFTP file transfer resume support on both PUT and GET. #775

Merged
merged 13 commits into from
May 27, 2022

Conversation

brenttyler
Copy link
Contributor

Internally SFTPFileTransfer has a few sanity checks to fall back to full replacement even if the resume flag is set.

SCP file transfers have not been changed to support this at this time.

…ly SFTPFileTransfer has a few sanity checks to fall back to full replacement even if the resume flag is set.

SCP file transfers have not been changed to support this at this time.
@hierynomus
Copy link
Owner

Please also write some tests

@brenttyler
Copy link
Contributor Author

Please also write some tests

Done!

@hierynomus
Copy link
Owner

1 comment :)

@hierynomus
Copy link
Owner

You need to add the .txt file to the ignore list of the license plugin in the build.

@brenttyler
Copy link
Contributor Author

You need to add the .txt file to the ignore list of the license plugin in the build.

I'm not as familiar with groovy scripting or license checks. I added the license header to the new JUnit test class which was missing and changed the license.excludes list to be the following. Will that work to exclude both of the test resources?

excludes(['**/djb/Curve25519.java', '**/sshj/common/Base64.java', '**/com/hierynomus/sshj/userauth/keyprovider/bcrypt/*.java', '**/test/resources/files/test_file*.txt'])

@brenttyler
Copy link
Contributor Author

Apparently that last commit created a security/snyk issue but I can't see the details.

@brenttyler
Copy link
Contributor Author

Just curious what the thoughts on this PR are now and what else I can do to help move it forward?

@hierynomus
Copy link
Owner

Just curious what the thoughts on this PR are now and what else I can do to help move it forward?

I've been thinking about the API that you've added. I'm not entirely sure I'm comfortable with a plain boolean and the "magic" underneath. I'm thinking more along the lines of having the read/write interfaces expose an offset at where to start writing/reading. That would make the API a bit more versatile and less magic.

@brenttyler
Copy link
Contributor Author

Just curious what the thoughts on this PR are now and what else I can do to help move it forward?

I've been thinking about the API that you've added. I'm not entirely sure I'm comfortable with a plain boolean and the "magic" underneath. I'm thinking more along the lines of having the read/write interfaces expose an offset at where to start writing/reading. That would make the API a bit more versatile and less magic.

Yeah, I can do that. Probably in my excitement to get it working I put too much of my use case into that but we should leave it up to the users of this API to know what they're asking for. They already have the tooling to discover what's on the destination already - the existence, current length, and last modified timestamp - with which to make informed offset decisions.

I'll work on that but it may be a few days.

@hierynomus
Copy link
Owner

Just curious what the thoughts on this PR are now and what else I can do to help move it forward?

I've been thinking about the API that you've added. I'm not entirely sure I'm comfortable with a plain boolean and the "magic" underneath. I'm thinking more along the lines of having the read/write interfaces expose an offset at where to start writing/reading. That would make the API a bit more versatile and less magic.

Yeah, I can do that. Probably in my excitement to get it working I put too much of my use case into that but we should leave it up to the users of this API to know what they're asking for. They already have the tooling to discover what's on the destination already - the existence, current length, and last modified timestamp - with which to make informed offset decisions.

I'll work on that but it may be a few days.

I fully understand, and I do get the usecase, but as you also pointed out, all the bits to make it work are there, except for the "starting at a particular offset". Making the API more reusable will actually allow more usecases to be implemented.

… internal decisions to be a user-specified long byte offset. This is cleaner but puts the onus on the caller to know exactly what they're asking for in their circumstance, which is ultimately better for a library like sshj.
@brenttyler
Copy link
Contributor Author

API changes made, tested, validated, and pushed for approval!

@brenttyler
Copy link
Contributor Author

Anything else I can do to help finalize this PR? We've been running it in production for a while now with no issues.

@codecov-commenter
Copy link

Codecov Report

Merging #775 (f986c55) into master (d7e402c) will increase coverage by 0.51%.
The diff coverage is 67.24%.

@@             Coverage Diff              @@
##             master     #775      +/-   ##
============================================
+ Coverage     64.33%   64.84%   +0.51%     
- Complexity     1460     1481      +21     
============================================
  Files           211      211              
  Lines          8622     8660      +38     
  Branches        809      812       +3     
============================================
+ Hits           5547     5616      +69     
+ Misses         2650     2616      -34     
- Partials        425      428       +3     
Impacted Files Coverage Δ
...rc/main/java/net/schmizz/sshj/sftp/SFTPClient.java 30.95% <0.00%> (-1.95%) ⬇️
...ava/net/schmizz/sshj/xfer/scp/SCPFileTransfer.java 77.41% <60.00%> (-5.92%) ⬇️
...n/java/net/schmizz/sshj/sftp/SFTPFileTransfer.java 70.37% <83.33%> (+19.69%) ⬆️
...rc/main/java/net/schmizz/sshj/sftp/RemoteFile.java 55.86% <100.00%> (+0.61%) ⬆️
...ain/java/net/schmizz/sshj/xfer/FileSystemFile.java 60.75% <100.00%> (+1.78%) ⬆️
...zz/sshj/connection/channel/ChannelInputStream.java 78.46% <0.00%> (-1.54%) ⬇️
...t/schmizz/sshj/connection/ConnectionException.java 33.33% <0.00%> (ø)
...in/java/net/schmizz/sshj/common/SecurityUtils.java 47.91% <0.00%> (+1.04%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7e402c...f986c55. Read the comment docs.

@hierynomus hierynomus merged commit 3de0302 into hierynomus:master May 27, 2022
@hierynomus
Copy link
Owner

Thanks for the nudge, I've approved and merged it! 👍

@brenttyler
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants