diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2018-10-01 14:15:29 +0800 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2018-10-01 14:15:29 +0800 |
commit | d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7 (patch) | |
tree | 2bf17d8d3ff14938e770f57d2b95dc19407fca7c /fs.go | |
parent | Add tcp keepalive (diff) | |
download | fasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.tar.gz fasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.tar.bz2 fasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.zip |
Remove fasthttp.ByteBuffer
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
Diffstat (limited to 'fs.go')
-rw-r--r-- | fs.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -17,6 +17,7 @@ import ( "time" "github.com/klauspost/compress/gzip" + "github.com/valyala/bytebufferpool" ) // ServeFileBytesUncompressed returns HTTP response containing file contents @@ -139,12 +140,12 @@ func NewVHostPathRewriter(slashesCount int) PathRewriteFunc { if len(host) == 0 { host = strInvalidHost } - b := AcquireByteBuffer() + b := bytebufferpool.Get() b.B = append(b.B, '/') b.B = append(b.B, host...) b.B = append(b.B, path...) ctx.URI().SetPathBytes(b.B) - ReleaseByteBuffer(b) + bytebufferpool.Put(b) return ctx.Path() } @@ -915,7 +916,7 @@ var ( ) func (h *fsHandler) createDirIndex(base *URI, dirPath string, mustCompress bool) (*fsFile, error) { - w := &ByteBuffer{} + w := &bytebufferpool.ByteBuffer{} basePathEscaped := html.EscapeString(string(base.Path())) fmt.Fprintf(w, "<html><head><title>%s</title><style>.dir { font-weight: bold }</style></head><body>", basePathEscaped) @@ -975,7 +976,7 @@ func (h *fsHandler) createDirIndex(base *URI, dirPath string, mustCompress bool) fmt.Fprintf(w, "</ul></body></html>") if mustCompress { - var zbuf ByteBuffer + var zbuf bytebufferpool.ByteBuffer zbuf.B = AppendGzipBytesLevel(zbuf.B, w.B, CompressDefaultCompression) w = &zbuf } |