commit | e9377c8373b34dca1f9655b2444adf52bcd32cb6 | [log] [tgz] |
---|---|---|
author | Joe Tsai <joetsai@digital-static.net> | Fri Jul 21 01:17:22 2023 -0700 |
committer | Joe Tsai <joetsai@digital-static.net> | Wed Aug 09 16:35:43 2023 -0700 |
tree | 13f8a5993abbd01665b76384c81a1ea9fe8b8993 | |
parent | ec1c8caca60e03e3816cadfaad20a0fd384a2a5e [diff] |
Properly handle io.EOF error conditions when reading Previously, the Server.Serve method would never return nil, because the infinite for-loop handling request packets would only break if reading a packet reported an error. A common termination condition is when the underlying connection is closed and recvPacket returns io.EOF. In which case Serve should ignore io.EOF and treat it as a normal shutdown. However, this means that recvPacket must correctly handle io.EOF such that it never reports io.EOF if a packet is partially read. There are two calls to io.ReadFull in recvPacket. The first call correctly forwards an io.EOF error if no additional bytes of the next packet are read. However, the second call incorrectly forwards io.EOF when no bytes of the payload could be read. This is incorrect since we already read the length and should convert the io.EOF into an io.ErrUnexpectedEOF.
The sftp
package provides support for file system operations on remote ssh servers using the SFTP subsystem. It also implements an SFTP server for serving files from the filesystem.
See https://pkg.go.dev/github.com/pkg/sftp for examples and usage.
The basic operation of the package mirrors the facilities of the os package.
The Walker interface for directory traversal is heavily inspired by Keith Rarick's fs package.
We welcome pull requests, bug fixes and issue reports.
Before proposing a large change, first please discuss your change by raising an issue.
For API/code bugs, please include a small, self contained code example to reproduce the issue. For pull requests, remember test coverage.
We try to handle issues and pull requests with a 0 open philosophy. That means we will try to address the submission as soon as possible and will work toward a resolution. If progress can no longer be made (eg. unreproducible bug) or stops (eg. unresponsive submitter), we will close the bug.
Thanks.