aboutsummaryrefslogtreecommitdiff
path: root/fs.go
diff options
context:
space:
mode:
authorGravatar Aoang <aoang@x2oe.com> 2022-08-14 17:31:57 +0800
committerGravatar GitHub <noreply@github.com> 2022-08-14 11:31:57 +0200
commitea6052464e7221956dedf9b9a523f8f9892c3d3b (patch)
tree089ef1b083c7d9edc7d54bc2485b1a564a2cc368 /fs.go
parentImprove Client timeout (#1346) (diff)
downloadfasthttp-ea6052464e7221956dedf9b9a523f8f9892c3d3b.tar.gz
fasthttp-ea6052464e7221956dedf9b9a523f8f9892c3d3b.tar.bz2
fasthttp-ea6052464e7221956dedf9b9a523f8f9892c3d3b.zip
Add Go 1.19 Support (#1355)v1.39.0
* Update Go Version to Go1.19.x And add cache * Fix CI Line endings * Update test CI Go Version to Go1.19.x And add cache * Update Gosec Security Scanner CI to securego/gosec@v2.12.0 * Format comment Go 1.19 adds support for links, lists, and clearer headings in doc comments. As part of this change, gofmt now reformats doc comments to make their rendered meaning clearer. See “Go Doc Comments” for syntax details and descriptions of common mistakes now highlighted by gofmt. As another part of this change, the new package go/doc/comment provides parsing and reformatting of doc comments as well as support for rendering them to HTML, Markdown, and text. ref: https://tip.golang.org/doc/go1.19 ref: https://tip.golang.org/doc/comment * Fix doc structure
Diffstat (limited to 'fs.go')
-rw-r--r--fs.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/fs.go b/fs.go
index 8491864..1e52c93 100644
--- a/fs.go
+++ b/fs.go
@@ -61,8 +61,8 @@ func ServeFileUncompressed(ctx *RequestCtx, path string) {
//
// HTTP response may contain uncompressed file contents in the following cases:
//
-// * Missing 'Accept-Encoding: gzip' request header.
-// * No write access to directory containing the file.
+// - Missing 'Accept-Encoding: gzip' request header.
+// - No write access to directory containing the file.
//
// Directory contents is returned if path points to directory.
//
@@ -83,8 +83,8 @@ func ServeFileBytes(ctx *RequestCtx, path []byte) {
//
// HTTP response may contain uncompressed file contents in the following cases:
//
-// * Missing 'Accept-Encoding: gzip' request header.
-// * No write access to directory containing the file.
+// - Missing 'Accept-Encoding: gzip' request header.
+// - No write access to directory containing the file.
//
// Directory contents is returned if path points to directory.
//
@@ -155,12 +155,11 @@ type PathRewriteFunc func(ctx *RequestCtx) []byte
//
// Examples:
//
-// * host=foobar.com, slashesCount=0, original path="/foo/bar".
+// - host=foobar.com, slashesCount=0, original path="/foo/bar".
// Resulting path: "/foobar.com/foo/bar"
//
-// * host=img.aaa.com, slashesCount=1, original path="/images/123/456.jpg"
+// - host=img.aaa.com, slashesCount=1, original path="/images/123/456.jpg"
// Resulting path: "/img.aaa.com/123/456.jpg"
-//
func NewVHostPathRewriter(slashesCount int) PathRewriteFunc {
return func(ctx *RequestCtx) []byte {
path := stripLeadingSlashes(ctx.Path(), slashesCount)
@@ -189,9 +188,9 @@ var strInvalidHost = []byte("invalid-host")
//
// Examples:
//
-// * slashesCount = 0, original path: "/foo/bar", result: "/foo/bar"
-// * slashesCount = 1, original path: "/foo/bar", result: "/bar"
-// * slashesCount = 2, original path: "/foo/bar", result: ""
+// - slashesCount = 0, original path: "/foo/bar", result: "/foo/bar"
+// - slashesCount = 1, original path: "/foo/bar", result: "/bar"
+// - slashesCount = 2, original path: "/foo/bar", result: ""
//
// The returned path rewriter may be used as FS.PathRewrite .
func NewPathSlashesStripper(slashesCount int) PathRewriteFunc {
@@ -205,9 +204,9 @@ func NewPathSlashesStripper(slashesCount int) PathRewriteFunc {
//
// Examples:
//
-// * prefixSize = 0, original path: "/foo/bar", result: "/foo/bar"
-// * prefixSize = 3, original path: "/foo/bar", result: "o/bar"
-// * prefixSize = 7, original path: "/foo/bar", result: "r"
+// - prefixSize = 0, original path: "/foo/bar", result: "/foo/bar"
+// - prefixSize = 3, original path: "/foo/bar", result: "o/bar"
+// - prefixSize = 7, original path: "/foo/bar", result: "r"
//
// The returned path rewriter may be used as FS.PathRewrite .
func NewPathPrefixStripper(prefixSize int) PathRewriteFunc {
@@ -350,9 +349,9 @@ const FSHandlerCacheDuration = 10 * time.Second
// from requested path before searching requested file in the root folder.
// Examples:
//
-// * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar"
-// * stripSlashes = 1, original path: "/foo/bar", result: "/bar"
-// * stripSlashes = 2, original path: "/foo/bar", result: ""
+// - stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar"
+// - stripSlashes = 1, original path: "/foo/bar", result: "/bar"
+// - stripSlashes = 2, original path: "/foo/bar", result: ""
//
// The returned request handler automatically generates index pages
// for directories without index.html.