Commit Graph

20 Commits

Author SHA1 Message Date
Nicola Murino 5dbfeffd12 request-server: add StatVFS support 2021-02-10 19:13:19 +01:00
Cassondra Foesch d696bdb2ff add PosixRename optional support same as Lstat 2020-09-25 16:16:01 +00:00
Nicola Murino ba3e280524 request-server: add lstat support
Add LstatFileLister, an optional interface for FileLister, if this
interface is implemented Lstat requests will call it otherwirse they
will be handled in the same way as Stat, as before
2020-09-06 08:26:58 +02:00
Nicola Murino ea67d57ce5 request-server: implement Open method
add an optional interface to FileWriter to allow to open a file for both
writing and reading

Fixes #374
2020-08-30 10:40:22 +02:00
John Eikenberry 1bc3ea14d1 fix issue with file put resume/append
Fixes issue with append uploads. Was opening the file with O_APPEND, but
it uses WriteAt() to write the data which doesn't work with a file
opened in append mode. Removing the append flag fixes the issue as the
client is sending the offsets anyways.

Also added a note to the Request server's FileWriter interface on
handling append flags.
2020-01-05 14:23:49 -08:00
Nicola Murino c5d967b3f6 notify errors to readerAt and writerAt
Add an optional interface that readerAt and writerAt can implement
to be notified about the error causing Serve() to exit with the
request still open.

Implement the TransferError interface in request-example.
This way we can run the request server example in debug mode, for example:

cd examples/request-server
go run -tags debug main.go

simulate a connection error killing an sftp client while uploading/downloading
and see the debug log that shows that the error is correctly notifyed

Fixes #306
2019-09-12 08:17:32 +02:00
Tommie Gannert 2c24eaad1c Implement the hardlink@openssh.com extension.
Both client and server. This is documented in

  https://github.com/openssh/openssh-portable/blob/master/PROTOCOL

Draft 7 of SFTP added support for SSH_FXP_LINK which supports both
symlinks and hardlinks, but unfortunately OpenSSH doesn't support
that:

  https://tools.ietf.org/html/draft-ietf-secsh-filexfer-07#section-7.7

Adding support for this as an option would be a nice extension to
this.
2019-08-25 20:16:37 -07:00
John Eikenberry 0f45c1c8bc improve Handler interface documentation
Include list of request.Methods each is used to handle.
2018-05-25 19:25:08 -07:00
John Eikenberry 9917fead0c handler type documenation improvements
Fixes #221
2018-01-16 14:42:06 -08:00
John Eikenberry 06477cae89 minor fix to doc comment 2017-08-20 17:47:32 -07:00
Dave Cheney f2782dd6fa Move Request.handle to *Request
Updates #192

Move handle() onto *Request, this has flow on effects to the interface
types declared in request-interface.go, the examples and the tests.

The decision to address #192 started with advice from gopl.io, but I
think has uncovered several bugs as many of the request methods operate
on copies of data stored in the RequestServer's cache. I think this is
unintentional, but may point to some correctness issues, see #193.
2017-08-13 17:22:00 +10:00
John Eikenberry 733115c415 Fixes #184; better fix for file batching
I didn't like how the initial fix for #184 required the handler author
to track the token/offset for the filelist. I came up with a way to do
it that mimic'd the FileReader handler interface using a method
something like ReaderAt except for file lists.

changed MaxFileinfoList to a var for testing and tweaking

Renaming FileInfoer interface to FileLister.
FileInfoer -> FileLister
Fileinfo -> Filelist
2017-08-10 15:36:41 -07:00
John Eikenberry ce4586e8a5 convert request to be pass by value
Encapsulate stateful data into sub-structures with pointer references
from the Request structure. This allows me to pass by value in most
cases to keep non-stateful (write once) data data race free and tightly
controlling access to stateful data to ease locking.
2017-02-18 18:20:37 -08:00
John Eikenberry 94ae9c6822 fix issue with out-of-order packets 2017-02-18 18:20:37 -08:00
John Eikenberry 9962211713 linter fixes 2017-02-18 18:20:37 -08:00
John Eikenberry 39fd50db3d better interface naming consistency 2017-02-18 18:20:36 -08:00
John Eikenberry e19ab67571 fleshed out processing handlers 2017-02-18 18:20:36 -08:00
John Eikenberry 06735900ce reworked handler/interfaces to new minimal set 2017-02-18 18:20:36 -08:00
John Eikenberry 06bf237860 reworked in branch and liked it 2017-02-18 18:20:36 -08:00
John Eikenberry d1634cd6a7 initial request server commit
builds but doesn't run
2017-02-18 18:20:36 -08:00