-
-
Notifications
You must be signed in to change notification settings - Fork 4k
-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
cannot use sendfile() in a http handler: #6546
Comments
Interesting; wouldn't io.Copy call ReadFrom for us?
|
it dit, but after
|
Actually stdlib file server uses
I guess we can test if the |
I'll make the necessary change later. You can reimplement that part and create a pr if you feel like it. |
I see you also created a issue at stdlib. For now I suggest you to use |
cannot use sendfile() in a http middleware handler:
OR
either way the sendfile / splice will not be called for the following reason:
caddyhttp.ResponseRecorder
is usingio.Copy()
(caddyhttp/responsewriter.go:47) instead ofhttp.response.ReadFrom()
*http.response
does not implementsyscall.Conn
interface;*os.File
got wrapped inos.fileWithoutWriteTo
(file.go:269
)(*http.response) ReadFrom()/sendfile()
try to use TCPConn.ReadFrom butsrc
is not a*os.File
(sendfile_linux_go:20
)genericReadFrom()
(tcpsock_posix.go:54)(caddy/2.8.4/go/1.22.5)
Originally posted by @terrywh in #4731 (comment)
Maybe change
responsewriter.go:48
fromio.Copy
to directly call*http.response.ReadFrom
?The text was updated successfully, but these errors were encountered: