How to change buffer size from net/http

Is there a pragmatic way to change the size of this buffer from the net/http level?

AFAIK, when calling http.ServeContent, this is the buffer it uses for each chunk of the streaming. I’d like to play with larger and smaller buffers in some profiling.

No… But you can use io.CopyBuffer yourself to experiment, instead of using ServeContent. You might need to implement the mine type stuff yourself, and likewise if you need to handle range requests, but otherwise it’s fairly straightforward.

Yeah, I need the whole thing; that’s what I was afraid of. There’s a lot of other stuff hidden in ServeContent like ETag support, etc. Maybe for testing I’ll just copy the code and change what I need to.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.