http-content-range

How to serve http partial content with Go?

99封情书 提交于 2019-11-27 20:18:06
I have a webserver written in go and I'm serving some audio files from different sources (local, other servers, S3). I want to enable serving partial content for this files so the HTML audio tags are able to seek and loop. How can I achive this? I know that the http package ServeContent function does this but how can I do it by serving the files myself? I need to do it without this so that I can serve files from different sources with the same handler. Serving partial content is non-trivial. See Byte serving on wikipedia for an introduction. You have to handle specific status codes and headers

How to serve http partial content with Go?

眉间皱痕 提交于 2019-11-26 20:02:17
问题 I have a webserver written in go and I'm serving some audio files from different sources (local, other servers, S3). I want to enable serving partial content for this files so the HTML audio tags are able to seek and loop. How can I achive this? I know that the http package ServeContent function does this but how can I do it by serving the files myself? I need to do it without this so that I can serve files from different sources with the same handler. 回答1: Serving partial content is non