Documentation ¶
Index ¶
- func CheckETag(w http.ResponseWriter, r *http.Request, modtime time.Time) (rangeReq string, done bool)
- func CheckLastModified(w http.ResponseWriter, r *http.Request, modifyTime time.Time) bool
- func DownloadFile(writer http.ResponseWriter, request *http.Request, filePath string, ...)
- func PanicError(err error)
- func RangesMIMESize(ranges []HttpRange, contentType string, contentSize int64) (encSize int64)
- func SumRangesSize(ranges []HttpRange) (size int64)
- type CountingWriter
- type HttpRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckETag ¶
func CheckETag(w http.ResponseWriter, r *http.Request, modtime time.Time) (rangeReq string, done bool)
handle ETag CheckETag implements If-None-Match and If-Range checks.
The ETag or modtime must have been previously set in the ResponseWriter's headers. The modtime is only compared at second granularity and may be the zero value to mean unknown.
The return value is the effective request "Range" header to use and whether this request is now considered done.
func CheckLastModified ¶
检查Last-Modified头。返回true: 请求已经完成了。(言下之意,文件没有修改过) 返回false:文件修改过。
func DownloadFile ¶
func DownloadFile( writer http.ResponseWriter, request *http.Request, filePath string, filename string, withContentDisposition bool)
file download. https://github.com/Masterminds/go-fileserver
func PanicError ¶
func PanicError(err error)
func RangesMIMESize ¶
RangesMIMESize returns the number of bytes it takes to encode the provided ranges as a multipart response.
func SumRangesSize ¶
Types ¶
type CountingWriter ¶
type CountingWriter int64
CountingWriter counts how many bytes have been written to it.