Skip to content

support sendfile when echo is static file server #2725

Open
@lp2jx0309

Description

@lp2jx0309

Issue Description

Response should implement io.ReaderFrom interface, only when used as a static file server can the sendfile function be used

Working code to debug

// ReadFrom is here to optimize copying from an [*os.File] regular file
// to a [*net.TCPConn] with sendfile, or from a supported src type such
// as a *net.TCPConn on Linux with splice.
func (w *response) ReadFrom(src io.Reader) (n int64, err error) {

Version/commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions