Repository: cloudwego/hertz
Pull request #278 (2022-09-28 07:20:26)

feat: add compile tag for json implementation
#### What type of PR is this?
feat

#### Check the PR title.
- [x] This PR title match the format: \<type\>(optional scope): \<description\>
- [x] The description of this PR title is user-oriented and clear enough for others to understand.


#### (Optional) Translate the PR title into Chinese.
增加编译tag控制实际使用的json库

#### (Optional) More detail description for this PR(en: English/zh: Chinese).
en: Add compile tag for json implementation. Sonic is still used by default, but with a cpu compile check. And its available for users to change the default json lib(sonic) to standard json lib through compile tag: `stdjson`
zh(optional): 增加编译tag控制json库的选择。Sonic仍然作为默认实现，不过增加了cpu检测（针对不符合sonic要求的cpu自动切换至标准json库）。同时新增了一个编译tag：`stdjson` 用于主动切换到标准json实现

#### Which issue(s) this PR fixes:
A better solution to #277 

codecov[bot]: # [Codecov](https://codecov.io/gh/cloudwego/hertz/pull/278?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego) Report
Base: **59.89**% // Head: **59.97**% // Increases project coverage by **`+0.08%`** :tada:
> Coverage data is based on head [(`7126c4b`)](https://codecov.io/gh/cloudwego/hertz/pull/278?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego) compared to base [(`f4db636`)](https://codecov.io/gh/cloudwego/hertz/commit/f4db6364fbf82c65c86759f24f3341d2b8ae7d12?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego).
> Patch coverage: 100.00% of modified lines in pull request are covered.

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff             @@
##           develop     #278      +/-   ##
===========================================
+ Coverage    59.89%   59.97%   +0.08%     
===========================================
  Files           79       79              
  Lines         8158     8158              
===========================================
+ Hits          4886     4893       +7     
+ Misses        2919     2912       -7     
  Partials       353      353              
```


| [Impacted Files](https://codecov.io/gh/cloudwego/hertz/pull/278?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego) | Coverage Δ | |
|---|---|---|
| [pkg/app/server/binding/binding.go](https://codecov.io/gh/cloudwego/hertz/pull/278/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego#diff-cGtnL2FwcC9zZXJ2ZXIvYmluZGluZy9iaW5kaW5nLmdv) | `81.81% <100.00%> (ø)` | |
| [pkg/app/server/render/json.go](https://codecov.io/gh/cloudwego/hertz/pull/278/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego#diff-cGtnL2FwcC9zZXJ2ZXIvcmVuZGVyL2pzb24uZ28=) | `48.14% <100.00%> (ø)` | |
| [pkg/common/compress/compress.go](https://codecov.io/gh/cloudwego/hertz/pull/278/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego#diff-cGtnL2NvbW1vbi9jb21wcmVzcy9jb21wcmVzcy5nbw==) | `83.80% <0.00%> (+2.85%)` | :arrow_up: |
| [pkg/common/timer/timer.go](https://codecov.io/gh/cloudwego/hertz/pull/278/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego#diff-cGtnL2NvbW1vbi90aW1lci90aW1lci5nbw==) | `80.95% <0.00%> (+19.04%)` | :arrow_up: |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/cloudwego/hertz/pull/278?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloudwego).

li-jin-gou: + 补充文档 https://www.cloudwego.io/zh/docs/hertz/reference/json/
welkeyever: compile tag 的位置规范 gofumpt 和 skywalking是相互冲突的，暂时忽略这个

Patch:
diff --git a/go.mod b/go.mod
index cf0ca35..f5be276 100644
--- a/go.mod
+++ b/go.mod
@@ -5,9 +5,10 @@ go 1.16
 require (
 	github.com/bytedance/go-tagexpr/v2 v2.9.2
 	github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7
-	github.com/bytedance/sonic v1.3.5
+	github.com/bytedance/sonic v1.5.0
 	github.com/cloudwego/netpoll v0.2.6
 	github.com/fsnotify/fsnotify v1.5.4
+	github.com/tidwall/gjson v1.13.0 // indirect
 	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
 	golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
 	google.golang.org/protobuf v1.27.1
diff --git a/go.sum b/go.sum
index 1ed067c..0d17981 100644
--- a/go.sum
+++ b/go.sum
@@ -2,8 +2,8 @@ github.com/bytedance/go-tagexpr/v2 v2.9.2 h1:QySJaAIQgOEDQBLS3x9BxOWrnhqu5sQ+f6H
 github.com/bytedance/go-tagexpr/v2 v2.9.2/go.mod h1:5qsx05dYOiUXOUgnQ7w3Oz8BYs2qtM/bJokdLb79wRM=
 github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7 h1:PtwsQyQJGxf8iaPptPNaduEIu9BnrNms+pcRdHAxZaM=
 github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q=
-github.com/bytedance/sonic v1.3.5 h1:xfBNhsG3QCC+AMCmCHxNQg0StI5IM/B9Jtwjqi5WlI0=
-github.com/bytedance/sonic v1.3.5/go.mod h1:V973WhNhGmvHxW6nQmsHEfHaoU9F3zTF+93rH03hcUQ=
+github.com/bytedance/sonic v1.5.0 h1:XWdTi8bwPgxIML+eNV1IwNuTROK6EUrQ65ey8yd6fRQ=
+github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
 github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06 h1:1sDoSuDPWzhkdzNVxCxtIaKiAe96ESVPv8coGwc1gZ4=
 github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
 github.com/cloudwego/netpoll v0.2.6 h1:vzN8cyayoa9RdCOG87tqkYO/j2hA4SMLC+vkcNUq6uI=
@@ -13,47 +13,34 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
 github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
-github.com/goccy/go-json v0.9.4 h1:L8MLKG2mvVXiQu07qB6hmfqeSYQdOnqPot2GhsIwIaI=
-github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
 github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/henrylee2cn/ameda v1.4.8/go.mod h1:liZulR8DgHxdK+MEwvZIylGnmcjzQ6N6f2PlWe7nEO4=
 github.com/henrylee2cn/ameda v1.4.10 h1:JdvI2Ekq7tapdPsuhrc4CaFiqw6QXFvZIULWJgQyCAk=
 github.com/henrylee2cn/ameda v1.4.10/go.mod h1:liZulR8DgHxdK+MEwvZIylGnmcjzQ6N6f2PlWe7nEO4=
 github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 h1:yE9ULgp02BhYIrO6sdV/FPe0xQM6fNHkVQW2IAymfM0=
 github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8/go.mod h1:Nhe/DM3671a5udlv2AdV2ni/MZzgfv2qrPL5nIi3EGQ=
-github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
-github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
 github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
 github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
-github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
 github.com/nyaruka/phonenumbers v1.0.55 h1:bj0nTO88Y68KeUQ/n3Lo2KgK7lM1hF7L9NFuwcCl3yg=
 github.com/nyaruka/phonenumbers v1.0.55/go.mod h1:sDaTZ/KPX5f8qyV9qN+hIm+4ZBARJrupC6LuhshJq1U=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
-github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
 github.com/tidwall/gjson v1.13.0 h1:3TFY9yxOQShrvmjdM76K+jc66zJeT6D3/VFFYCGQf7M=
 github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
 github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
 github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
 github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
 github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
-github.com/tidwall/sjson v1.2.4 h1:cuiLzLnaMeBhRmEv00Lpk3tkYrcxpmbU81tAY4Dw0tc=
-github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM=
 github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
 github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
 golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
diff --git a/internal/stats/tracer.go b/internal/stats/tracer.go
index 1d92cfb..e00b09a 100644
--- a/internal/stats/tracer.go
+++ b/internal/stats/tracer.go
@@ -67,6 +67,6 @@ func (ctl *Controller) HasTracer() bool {
 
 func (ctl *Controller) tryRecover() {
 	if err := recover(); err != nil {
-		hlog.Warnf("HERTZ: Panic happened during tracer call. This doesn't affect the http call, but may lead to lack of monitor data such as metrics and logs: %s, %s", err, string(debug.Stack()))
+		hlog.SystemLogger().Warnf("Panic happened during tracer call. This doesn't affect the http call, but may lead to lack of monitor data such as metrics and logs: %s, %s", err, string(debug.Stack()))
 	}
 }
diff --git a/pkg/app/client/loadbalance/lbcache.go b/pkg/app/client/loadbalance/lbcache.go
index c249ebe..47acdd4 100644
--- a/pkg/app/client/loadbalance/lbcache.go
+++ b/pkg/app/client/loadbalance/lbcache.go
@@ -111,7 +111,7 @@ func (b *BalancerFactory) refresh() {
 		b.cache.Range(func(key, value interface{}) bool {
 			res, err := b.resolver.Resolve(context.Background(), key.(string))
 			if err != nil {
-				hlog.Warnf("Hertz: resolver refresh failed, key=%s error=%s", key, err.Error())
+				hlog.SystemLogger().Warnf("resolver refresh failed, key=%s error=%s", key, err.Error())
 				return true
 			}
 			renameResultCacheKey(&res, b.resolver.Name())
@@ -132,7 +132,7 @@ func (b *BalancerFactory) GetInstance(ctx context.Context, req *protocol.Request
 	atomic.StoreInt32(&cacheRes.expire, 0)
 	ins := b.balancer.Pick(cacheRes.res.Load().(discovery.Result))
 	if ins == nil {
-		hlog.Errorf("HERTZ: null instance. serviceName: %s, options: %v", string(req.Host()), req.Options())
+		hlog.SystemLogger().Errorf("null instance. serviceName: %s, options: %v", string(req.Host()), req.Options())
 		return nil, errors.NewPublic("instance not found")
 	}
 	return ins, nil
diff --git a/pkg/app/client/loadbalance/weight_random.go b/pkg/app/client/loadbalance/weight_random.go
index 1fa0f57..381e576 100644
--- a/pkg/app/client/loadbalance/weight_random.go
+++ b/pkg/app/client/loadbalance/weight_random.go
@@ -59,7 +59,7 @@ func (wb *weightedBalancer) calcWeightInfo(e discovery.Result) *weightInfo {
 			w.weightSum += weight
 			cnt++
 		} else {
-			hlog.Warnf("HERTZ: Invalid weight=%d on instance address=%s", weight, e.Instances[idx].Address())
+			hlog.SystemLogger().Warnf("Invalid weight=%d on instance address=%s", weight, e.Instances[idx].Address())
 		}
 	}
 
diff --git a/pkg/app/client/retry/retry.go b/pkg/app/client/retry/retry.go
index f866d05..f9e01bf 100644
--- a/pkg/app/client/retry/retry.go
+++ b/pkg/app/client/retry/retry.go
@@ -18,8 +18,9 @@ package retry
 
 import (
 	"math"
-	"math/rand"
 	"time"
+
+	"github.com/bytedance/gopkg/lang/fastrand"
 )
 
 // Config All configurations related to retry
@@ -61,13 +62,19 @@ func FixedDelayPolicy(_ uint, _ error, retryConfig *Config) time.Duration {
 	return retryConfig.Delay
 }
 
-// RandomDelayPolicy is a DelayPolicyFunc which picks a random delay up toRetryConfig.MaxJitter
+// RandomDelayPolicy is a DelayPolicyFunc which picks a random delay up to RetryConfig.MaxJitter, if the retryConfig.MaxJitter less than or equal to 0, the final delay is 0
 func RandomDelayPolicy(_ uint, _ error, retryConfig *Config) time.Duration {
-	return time.Duration(rand.Int63n(int64(retryConfig.MaxJitter)))
+	if retryConfig.MaxJitter <= 0 {
+		return 0 * time.Millisecond
+	}
+	return time.Duration(fastrand.Int63n(int64(retryConfig.MaxJitter)))
 }
 
-// BackOffDelayPolicy is a DelayPolicyFunc which exponentially increases delay between consecutive retries
+// BackOffDelayPolicy is a DelayPolicyFunc which exponentially increases delay between consecutive retries, if the retryConfig.Delay less than or equal to 0, the final delay is 0
 func BackOffDelayPolicy(attempts uint, _ error, retryConfig *Config) time.Duration {
+	if retryConfig.Delay <= 0 {
+		return 0 * time.Millisecond
+	}
 	// 1 << 63 would overflow signed int64 (time.Duration), thus 62.
 	const max uint = 62
 	if attempts > max {
@@ -94,8 +101,12 @@ func CombineDelay(delays ...DelayPolicyFunc) DelayPolicyFunc {
 	}
 }
 
-// Delay generate the delay time required for the current retry
+// Delay generate the delay time required for the current retry config, if the retryConfig.DelayPolicy == nil, the final delay is 0
 func Delay(attempts uint, err error, retryConfig *Config) time.Duration {
+	if retryConfig.DelayPolicy == nil {
+		return 0 * time.Millisecond
+	}
+
 	delayTime := retryConfig.DelayPolicy(attempts, err, retryConfig)
 	if retryConfig.MaxDelay > 0 && delayTime > retryConfig.MaxDelay {
 		delayTime = retryConfig.MaxDelay
diff --git a/pkg/app/fs.go b/pkg/app/fs.go
index 24eba04..644a9e9 100644
--- a/pkg/app/fs.go
+++ b/pkg/app/fs.go
@@ -286,7 +286,7 @@ func ServeFile(ctx *RequestContext, path string) {
 		// extend relative path to absolute path
 		var err error
 		if path, err = filepath.Abs(path); err != nil {
-			hlog.Errorf("HERTZ: Cannot resolve path=%q to absolute file error=%s", path, err)
+			hlog.SystemLogger().Errorf("Cannot resolve path=%q to absolute file error=%s", path, err)
 			ctx.AbortWithMsg("Internal Server Error", consts.StatusInternalServerError)
 			return
 		}
@@ -805,7 +805,7 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 	path = stripTrailingSlashes(path)
 
 	if n := bytes.IndexByte(path, 0); n >= 0 {
-		hlog.Errorf("HERTZ: Cannot serve path with nil byte at position=%d, path=%q", n, path)
+		hlog.SystemLogger().Errorf("Cannot serve path with nil byte at position=%d, path=%q", n, path)
 		ctx.AbortWithMsg("Are you a hacker?", consts.StatusBadRequest)
 		return
 	}
@@ -814,7 +814,7 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 		// since ctx.Path must normalize and sanitize the path.
 
 		if n := bytes.Index(path, bytestr.StrSlashDotDotSlash); n >= 0 {
-			hlog.Errorf("HERTZ: Cannot serve path with '/../' at position=%d due to security reasons, path=%q", n, path)
+			hlog.SystemLogger().Errorf("Cannot serve path with '/../' at position=%d due to security reasons, path=%q", n, path)
 			ctx.AbortWithMsg("Internal Server Error", consts.StatusInternalServerError)
 			return
 		}
@@ -842,7 +842,7 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 		ff, err = h.openFSFile(filePath, mustCompress)
 
 		if mustCompress && err == errNoCreatePermission {
-			hlog.Errorf("HERTZ: Insufficient permissions for saving compressed file for path=%q. Serving uncompressed file. "+
+			hlog.SystemLogger().Errorf("Insufficient permissions for saving compressed file for path=%q. Serving uncompressed file. "+
 				"Allow write access to the directory with this file in order to improve hertz performance", filePath)
 			mustCompress = false
 			ff, err = h.openFSFile(filePath, mustCompress)
@@ -850,12 +850,12 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 		if err == errDirIndexRequired {
 			ff, err = h.openIndexFile(ctx, filePath, mustCompress)
 			if err != nil {
-				hlog.Errorf("HERTZ: Cannot open dir index, path=%q, error=%s", filePath, err)
+				hlog.SystemLogger().Errorf("Cannot open dir index, path=%q, error=%s", filePath, err)
 				ctx.AbortWithMsg("Directory index is forbidden", consts.StatusForbidden)
 				return
 			}
 		} else if err != nil {
-			hlog.Errorf("HERTZ: Cannot open file=%q, error=%s", filePath, err)
+			hlog.SystemLogger().Errorf("Cannot open file=%q, error=%s", filePath, err)
 			if h.pathNotFound == nil {
 				ctx.AbortWithMsg("Cannot open requested path", consts.StatusNotFound)
 			} else {
@@ -892,7 +892,7 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 
 	r, err := ff.NewReader()
 	if err != nil {
-		hlog.Errorf("HERTZ: Cannot obtain file reader for path=%q, error=%s", path, err)
+		hlog.SystemLogger().Errorf("Cannot obtain file reader for path=%q, error=%s", path, err)
 		ctx.AbortWithMsg("Internal Server Error", consts.StatusInternalServerError)
 		return
 	}
@@ -910,14 +910,14 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 			startPos, endPos, err := ParseByteRange(byteRange, contentLength)
 			if err != nil {
 				r.(io.Closer).Close()
-				hlog.Errorf("HERTZ: Cannot parse byte range %q for path=%q,error=%s", byteRange, path, err)
+				hlog.SystemLogger().Errorf("Cannot parse byte range %q for path=%q,error=%s", byteRange, path, err)
 				ctx.AbortWithMsg("Range Not Satisfiable", consts.StatusRequestedRangeNotSatisfiable)
 				return
 			}
 
 			if err = r.(byteRangeUpdater).UpdateByteRange(startPos, endPos); err != nil {
 				r.(io.Closer).Close()
-				hlog.Errorf("HERTZ: Cannot seek byte range %q for path=%q, error=%s", byteRange, path, err)
+				hlog.SystemLogger().Errorf("Cannot seek byte range %q for path=%q, error=%s", byteRange, path, err)
 				ctx.AbortWithMsg("Internal Server Error", consts.StatusInternalServerError)
 				return
 			}
@@ -937,7 +937,7 @@ func (h *fsHandler) handleRequest(c context.Context, ctx *RequestContext) {
 		ctx.Response.Header.SetContentLength(contentLength)
 		if rc, ok := r.(io.Closer); ok {
 			if err := rc.Close(); err != nil {
-				hlog.Errorf("HERTZ: Cannot close file reader: error=%s", err)
+				hlog.SystemLogger().Errorf("Cannot close file reader: error=%s", err)
 				ctx.AbortWithMsg("Internal Server Error", consts.StatusInternalServerError)
 				return
 			}
diff --git a/pkg/app/middlewares/server/recovery/recovery.go b/pkg/app/middlewares/server/recovery/recovery.go
index 0710056..2dbb5cc 100644
--- a/pkg/app/middlewares/server/recovery/recovery.go
+++ b/pkg/app/middlewares/server/recovery/recovery.go
@@ -43,7 +43,7 @@ func Recovery() app.HandlerFunc {
 			if err := recover(); err != nil {
 				stack := stack(3)
 
-				hlog.CtxErrorf(c, "[Recovery] %s panic recovered:\n%s\n%s\n",
+				hlog.SystemLogger().CtxErrorf(c, "[Recovery] %s panic recovered:\n%s\n%s\n",
 					timeFormat(time.Now()), err, stack)
 				ctx.AbortWithStatus(consts.StatusInternalServerError)
 			}
diff --git a/pkg/app/server/binding/binding.go b/pkg/app/server/binding/binding.go
index ac5aee5..1d72981 100644
--- a/pkg/app/server/binding/binding.go
+++ b/pkg/app/server/binding/binding.go
@@ -23,13 +23,13 @@ import (
 	"github.com/bytedance/go-tagexpr/v2/binding"
 	"github.com/bytedance/go-tagexpr/v2/binding/gjson"
 	"github.com/bytedance/go-tagexpr/v2/validator"
-	"github.com/bytedance/sonic"
+	hjson "github.com/cloudwego/hertz/pkg/common/json"
 	"github.com/cloudwego/hertz/pkg/protocol"
 	"github.com/cloudwego/hertz/pkg/route/param"
 )
 
 func init() {
-	binding.ResetJSONUnmarshaler(sonic.Unmarshal)
+	binding.ResetJSONUnmarshaler(hjson.Unmarshal)
 }
 
 var defaultBinder = binding.Default()
diff --git a/pkg/app/server/hertz.go b/pkg/app/server/hertz.go
index b8edc92..651b1ed 100644
--- a/pkg/app/server/hertz.go
+++ b/pkg/app/server/hertz.go
@@ -67,20 +67,20 @@ func (h *Hertz) Spin() {
 	}
 
 	if err := signalWaiter(errCh); err != nil {
-		hlog.Errorf("HERTZ: Receive close signal: error=%v", err)
+		hlog.SystemLogger().Errorf("Receive close signal: error=%v", err)
 		if err := h.Engine.Close(); err != nil {
-			hlog.Errorf("HERTZ: Close error=%v", err)
+			hlog.SystemLogger().Errorf("Close error=%v", err)
 		}
 		return
 	}
 
-	hlog.Infof("HERTZ: Begin graceful shutdown, wait at most num=%d seconds...", h.GetOptions().ExitWaitTimeout/time.Second)
+	hlog.SystemLogger().Infof("Begin graceful shutdown, wait at most num=%d seconds...", h.GetOptions().ExitWaitTimeout/time.Second)
 
 	ctx, cancel := context.WithTimeout(context.Background(), h.GetOptions().ExitWaitTimeout)
 	defer cancel()
 
 	if err := h.Shutdown(ctx); err != nil {
-		hlog.Errorf("HERTZ: Shutdown error=%v", err)
+		hlog.SystemLogger().Errorf("Shutdown error=%v", err)
 	}
 }
 
@@ -124,7 +124,7 @@ func (h *Hertz) initOnRunHooks(errChan chan error) {
 			// delay register 1s
 			time.Sleep(1 * time.Second)
 			if err := opt.Registry.Register(opt.RegistryInfo); err != nil {
-				hlog.Errorf("HERTZ: Register error=%v", err)
+				hlog.SystemLogger().Errorf("Register error=%v", err)
 				// pass err to errChan
 				errChan <- err
 			}
diff --git a/pkg/app/server/render/html.go b/pkg/app/server/render/html.go
index 03cf687..f31e33a 100644
--- a/pkg/app/server/render/html.go
+++ b/pkg/app/server/render/html.go
@@ -160,13 +160,13 @@ func (h *HTMLDebug) startChecker() {
 
 	if h.RefreshInterval > 0 {
 		go func() {
-			hlog.Debugf("HERTZ[HTMLDebug]: HTML template reloader started with interval %v", h.RefreshInterval)
+			hlog.SystemLogger().Debugf("[HTMLDebug] HTML template reloader started with interval %v", h.RefreshInterval)
 			for {
 				n := time.Now()
 				if n.UTC().Sub(h.updateTimeStamp.UTC()) > h.RefreshInterval {
-					hlog.Debugf("HERTZ[HTMLDebug]: triggering HTML template reloader")
+					hlog.SystemLogger().Debugf("[HTMLDebug] triggering HTML template reloader")
 					h.reloadCh <- struct{}{}
-					hlog.Debugf("HERTZ[HTMLDebug]: HTML template has been reloaded, next reload in %v", h.RefreshInterval)
+					hlog.SystemLogger().Debugf("[HTMLDebug] HTML template has been reloaded, next reload in %v", h.RefreshInterval)
 					h.updateTimeStamp = time.Now()
 				}
 			}
@@ -181,15 +181,15 @@ func (h *HTMLDebug) startChecker() {
 	h.watcher = watcher
 	for _, f := range h.Files {
 		err := watcher.Add(f)
-		hlog.Debugf("HERTZ[HTMLDebug]: watching file: %s", f)
+		hlog.SystemLogger().Debugf("[HTMLDebug] watching file: %s", f)
 		if err != nil {
-			hlog.Errorf("HERTZ[HTMLDebug]: add watching file: %s, error happened: %v", f, err)
+			hlog.SystemLogger().Errorf("[HTMLDebug] add watching file: %s, error happened: %v", f, err)
 		}
 
 	}
 
 	go func() {
-		hlog.Debugf("HERTZ[HTMLDebug]: HTML template reloader started with file watcher")
+		hlog.SystemLogger().Debugf("[HTMLDebug] HTML template reloader started with file watcher")
 		for {
 			select {
 			case event, ok := <-watcher.Events:
@@ -197,15 +197,15 @@ func (h *HTMLDebug) startChecker() {
 					return
 				}
 				if event.Op&fsnotify.Write == fsnotify.Write {
-					hlog.Debugf("HERTZ[HTMLDebug]: modified file: %s, html render template will be reloaded at the next rendering", event.Name)
+					hlog.SystemLogger().Debugf("[HTMLDebug] modified file: %s, html render template will be reloaded at the next rendering", event.Name)
 					h.reloadCh <- struct{}{}
-					hlog.Debugf("HERTZ[HTMLDebug]: HTML template has been reloaded")
+					hlog.SystemLogger().Debugf("[HTMLDebug] HTML template has been reloaded")
 				}
 			case err, ok := <-watcher.Errors:
 				if !ok {
 					return
 				}
-				hlog.Errorf("HERTZ: error happened when watching the rendering files: %v", err)
+				hlog.SystemLogger().Errorf("error happened when watching the rendering files: %v", err)
 			}
 		}
 	}()
diff --git a/pkg/app/server/render/json.go b/pkg/app/server/render/json.go
index 69aa2f9..b206776 100644
--- a/pkg/app/server/render/json.go
+++ b/pkg/app/server/render/json.go
@@ -45,7 +45,7 @@ import (
 	"bytes"
 	"encoding/json"
 
-	"github.com/bytedance/sonic"
+	hjson "github.com/cloudwego/hertz/pkg/common/json"
 	"github.com/cloudwego/hertz/pkg/protocol"
 )
 
@@ -55,7 +55,7 @@ type JSONMarshaler func(v interface{}) ([]byte, error)
 var jsonMarshalFunc JSONMarshaler
 
 func init() {
-	ResetJSONMarshal(sonic.Marshal)
+	ResetJSONMarshal(hjson.Marshal)
 }
 
 func ResetJSONMarshal(fn JSONMarshaler) {
diff --git a/pkg/common/hlog/default.go b/pkg/common/hlog/default.go
index 3b95484..6bc624a 100644
--- a/pkg/common/hlog/default.go
+++ b/pkg/common/hlog/default.go
@@ -24,34 +24,6 @@ import (
 	"os"
 )
 
-var logger FullLogger = &defaultLogger{
-	stdlog: log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile|log.Lmicroseconds),
-}
-
-// SetOutput sets the output of default logger. By default, it is stderr.
-func SetOutput(w io.Writer) {
-	logger.SetOutput(w)
-}
-
-// SetLevel sets the level of logs below which logs will not be output.
-// The default log level is LevelTrace.
-// Note that this method is not concurrent-safe.
-func SetLevel(lv Level) {
-	logger.SetLevel(lv)
-}
-
-// DefaultLogger return the default logger for hertz.
-func DefaultLogger() FullLogger {
-	return logger
-}
-
-// SetLogger sets the default logger.
-// Note that this method is not concurrent-safe and must not be called
-// after the use of DefaultLogger and global functions in this package.
-func SetLogger(v FullLogger) {
-	logger = v
-}
-
 // Fatal calls the default logger's Fatal method and then os.Exit(1).
 func Fatal(v ...interface{}) {
 	logger.Fatal(v...)
@@ -160,6 +132,7 @@ func CtxTracef(ctx context.Context, format string, v ...interface{}) {
 type defaultLogger struct {
 	stdlog *log.Logger
 	level  Level
+	depth  int
 }
 
 func (ll *defaultLogger) SetOutput(w io.Writer) {
@@ -180,7 +153,7 @@ func (ll *defaultLogger) logf(lv Level, format *string, v ...interface{}) {
 	} else {
 		msg += fmt.Sprint(v...)
 	}
-	ll.stdlog.Output(4, msg)
+	ll.stdlog.Output(ll.depth, msg)
 	if lv == LevelFatal {
 		os.Exit(1)
 	}
diff --git a/pkg/common/hlog/hlog.go b/pkg/common/hlog/hlog.go
new file mode 100644
index 0000000..11a8161
--- /dev/null
+++ b/pkg/common/hlog/hlog.go
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package hlog
+
+import (
+	"io"
+	"log"
+	"os"
+)
+
+const (
+	systemLogPrefix = "HERTZ: "
+)
+
+var (
+	// Provide default logger for users to use
+	logger FullLogger = &defaultLogger{
+		stdlog: log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile|log.Lmicroseconds),
+		depth:  4,
+	}
+
+	// Provide system logger for print system log
+	sysLogger FullLogger = &systemLogger{
+		&defaultLogger{
+			stdlog: log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile|log.Lmicroseconds),
+			depth:  4,
+		},
+		systemLogPrefix,
+	}
+)
+
+// SetOutput sets the output of default logger and system logger. By default, it is stderr.
+func SetOutput(w io.Writer) {
+	logger.SetOutput(w)
+	sysLogger.SetOutput(w)
+}
+
+// SetLevel sets the level of logs below which logs will not be output.
+// The default logger and system logger level is LevelTrace.
+// Note that this method is not concurrent-safe.
+func SetLevel(lv Level) {
+	logger.SetLevel(lv)
+	sysLogger.SetLevel(lv)
+}
+
+// DefaultLogger return the default logger for hertz.
+func DefaultLogger() FullLogger {
+	return logger
+}
+
+// SystemLogger return the system logger for hertz to print system log.
+// This function is not recommended for users to use.
+func SystemLogger() FullLogger {
+	return sysLogger
+}
+
+// SetSystemLogger sets the system logger.
+// Note that this method is not concurrent-safe and must not be called
+// This function is not recommended for users to use.
+func SetSystemLogger(v FullLogger) {
+	sysLogger = &systemLogger{v, systemLogPrefix}
+}
+
+// SetLogger sets the default logger and the system logger.
+// Note that this method is not concurrent-safe and must not be called
+// after the use of DefaultLogger and global functions in this package.
+func SetLogger(v FullLogger) {
+	logger = v
+	SetSystemLogger(v)
+}
diff --git a/pkg/common/hlog/system.go b/pkg/common/hlog/system.go
new file mode 100644
index 0000000..e931517
--- /dev/null
+++ b/pkg/common/hlog/system.go
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package hlog
+
+import (
+	"context"
+	"io"
+	"strings"
+	"sync"
+)
+
+var builderPool = sync.Pool{New: func() interface{} {
+	return &strings.Builder{} // nolint:SA6002
+}}
+
+type systemLogger struct {
+	logger FullLogger
+	prefix string
+}
+
+func (ll *systemLogger) SetOutput(w io.Writer) {
+	ll.logger.SetOutput(w)
+}
+
+func (ll *systemLogger) SetLevel(lv Level) {
+	ll.logger.SetLevel(lv)
+}
+
+func (ll *systemLogger) Fatal(v ...interface{}) {
+	ll.logger.Fatal(v...)
+}
+
+func (ll *systemLogger) Error(v ...interface{}) {
+	ll.logger.Error(v...)
+}
+
+func (ll *systemLogger) Warn(v ...interface{}) {
+	ll.logger.Warn(v...)
+}
+
+func (ll *systemLogger) Notice(v ...interface{}) {
+	ll.logger.Notice(v...)
+}
+
+func (ll *systemLogger) Info(v ...interface{}) {
+	ll.logger.Info(v...)
+}
+
+func (ll *systemLogger) Debug(v ...interface{}) {
+	ll.logger.Debug(v...)
+}
+
+func (ll *systemLogger) Trace(v ...interface{}) {
+	ll.logger.Trace(v...)
+}
+
+func (ll *systemLogger) Fatalf(format string, v ...interface{}) {
+	ll.logger.Fatalf(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Errorf(format string, v ...interface{}) {
+	ll.logger.Errorf(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Warnf(format string, v ...interface{}) {
+	ll.logger.Warnf(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Noticef(format string, v ...interface{}) {
+	ll.logger.Noticef(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Infof(format string, v ...interface{}) {
+	ll.logger.Infof(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Debugf(format string, v ...interface{}) {
+	ll.logger.Debugf(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) Tracef(format string, v ...interface{}) {
+	ll.logger.Tracef(ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxFatalf(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxFatalf(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxErrorf(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxErrorf(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxWarnf(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxWarnf(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxNoticef(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxNoticef(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxInfof(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxInfof(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxDebugf(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxDebugf(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) CtxTracef(ctx context.Context, format string, v ...interface{}) {
+	ll.logger.CtxTracef(ctx, ll.addPrefix(format), v...)
+}
+
+func (ll *systemLogger) addPrefix(format string) string {
+	builder := builderPool.Get().(*strings.Builder)
+	builder.Grow(len(format) + len(ll.prefix))
+	builder.WriteString(ll.prefix)
+	builder.WriteString(format)
+	s := builder.String()
+	builder.Reset()
+	builderPool.Put(builder) // nolint:SA6002
+	return s
+}
diff --git a/pkg/common/json/sonic.go b/pkg/common/json/sonic.go
new file mode 100644
index 0000000..597ba8d
--- /dev/null
+++ b/pkg/common/json/sonic.go
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//go:build (linux || windows || darwin) && amd64
+// +build linux windows darwin
+// +build amd64
+
+package json
+
+import "github.com/bytedance/sonic"
+
+// Name is the name of the effective json package.
+const Name = "sonic"
+
+var (
+	json = sonic.ConfigStd
+	// Marshal is sonic implementation exported by hertz which is used by rendering.
+	Marshal = json.Marshal
+	// Unmarshal is sonic implementation exported by hertz which is used by binding.
+	Unmarshal = json.Unmarshal
+	// MarshalIndent is sonic implementation exported by hertz.
+	MarshalIndent = json.MarshalIndent
+	// NewDecoder is sonic implementation exported by hertz.
+	NewDecoder = json.NewDecoder
+	// NewEncoder is sonic implementation exported by hertz.
+	NewEncoder = json.NewEncoder
+)
diff --git a/pkg/common/json/std.go b/pkg/common/json/std.go
new file mode 100644
index 0000000..ff1d99c
--- /dev/null
+++ b/pkg/common/json/std.go
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//go:build stdjson || !(amd64 && (linux || windows || darwin))
+// +build stdjson !amd64 !linux,!windows,!darwin
+
+package json
+
+import "encoding/json"
+
+// Name is the name of the effective json package.
+const Name = "encoding/json"
+
+var (
+	// Marshal is standard implementation exported by hertz which is used by rendering.
+	Marshal = json.Marshal
+	// Unmarshal is standard implementation exported by hertz which is used by binding.
+	Unmarshal = json.Unmarshal
+	// MarshalIndent is standard implementation exported by hertz.
+	MarshalIndent = json.MarshalIndent
+	// NewDecoder is standard implementation exported by hertz.
+	NewDecoder = json.NewDecoder
+	// NewEncoder is standard implementation exported by hertz.
+	NewEncoder = json.NewEncoder
+)
diff --git a/pkg/network/netpoll/connection.go b/pkg/network/netpoll/connection.go
index a407abd..f456d3c 100644
--- a/pkg/network/netpoll/connection.go
+++ b/pkg/network/netpoll/connection.go
@@ -76,7 +76,7 @@ func (c *Conn) Flush() error {
 
 func (c *Conn) HandleSpecificError(err error, rip string) (needIgnore bool) {
 	if errors.Is(err, netpoll.ErrConnClosed) {
-		hlog.Warnf("HERTZ: Netpoll error=%s, remoteAddr=%s", err.Error(), rip)
+		hlog.SystemLogger().Warnf("Netpoll error=%s, remoteAddr=%s", err.Error(), rip)
 		return true
 	}
 	return false
diff --git a/pkg/network/netpoll/transport.go b/pkg/network/netpoll/transport.go
index 803e34e..844445e 100644
--- a/pkg/network/netpoll/transport.go
+++ b/pkg/network/netpoll/transport.go
@@ -88,7 +88,7 @@ func (t *transporter) ListenAndServe(onReq network.OnData) (err error) {
 	}
 
 	// Start Server
-	hlog.Infof("HERTZ: HTTP server listening on address=%s", t.listener.Addr().String())
+	hlog.SystemLogger().Infof("HTTP server listening on address=%s", t.listener.Addr().String())
 	t.RLock()
 	err = t.eventLoop.Serve(t.listener)
 	t.RUnlock()
diff --git a/pkg/network/standard/transport.go b/pkg/network/standard/transport.go
index 2739830..624f941 100644
--- a/pkg/network/standard/transport.go
+++ b/pkg/network/standard/transport.go
@@ -60,11 +60,12 @@ func (t *transport) serve() (err error) {
 	if err != nil {
 		return err
 	}
+	hlog.SystemLogger().Infof("HERTZ: HTTP server listening on address=%s", t.ln.Addr().String())
 	for {
 		conn, err := t.ln.Accept()
 		var c network.Conn
 		if err != nil {
-			hlog.Errorf("HERTZ: Error=%s", err.Error())
+			hlog.SystemLogger().Errorf("Error=%s", err.Error())
 			return err
 		}
 		if t.tls != nil {
diff --git a/pkg/protocol/cookie.go b/pkg/protocol/cookie.go
index c8de4c0..7ca22c6 100644
--- a/pkg/protocol/cookie.go
+++ b/pkg/protocol/cookie.go
@@ -546,7 +546,7 @@ func getCookieKey(dst, src []byte) []byte {
 func warnIfInvalid(value []byte) bool {
 	for i := range value {
 		if bytesconv.ValidCookieValueTable[value[i]] == 0 {
-			hlog.Warnf("HERTZ: Invalid byte %q in Cookie.Value, "+
+			hlog.SystemLogger().Warnf("Invalid byte %q in Cookie.Value, "+
 				"it may cause compatibility problems with user agents", value[i])
 			return false
 		}
diff --git a/pkg/protocol/header.go b/pkg/protocol/header.go
index 9291d5f..eb28ade 100644
--- a/pkg/protocol/header.go
+++ b/pkg/protocol/header.go
@@ -461,7 +461,7 @@ func checkWriteHeaderCode(code int) {
 	// For now, we only emit a warning for bad codes.
 	// In the future we might block things over 599 or under 100
 	if code < 100 || code > 599 {
-		hlog.Warnf("Invalid StatusCode code %v, status code should not be under 100 or over 599.\n"+
+		hlog.SystemLogger().Warnf("Invalid StatusCode code %v, status code should not be under 100 or over 599.\n"+
 			"For more info: https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes", code)
 	}
 }
diff --git a/pkg/protocol/http1/client.go b/pkg/protocol/http1/client.go
index f310ee6..cb12bc7 100644
--- a/pkg/protocol/http1/client.go
+++ b/pkg/protocol/http1/client.go
@@ -919,7 +919,7 @@ func dialAddr(addr string, dial network.Dialer, dialDualStack bool, tlsConfig *t
 	var conn network.Conn
 	var err error
 	if dial == nil {
-		hlog.Warnf("HERTZ: HostClient: no dialer specified, trying to use default dialer")
+		hlog.SystemLogger().Warnf("HostClient: no dialer specified, trying to use default dialer")
 		dial = dialer.DefaultDialer()
 	}
 	dialFunc := dial.DialConnection
diff --git a/pkg/protocol/suite/server.go b/pkg/protocol/suite/server.go
index b489e0d..8d58865 100644
--- a/pkg/protocol/suite/server.go
+++ b/pkg/protocol/suite/server.go
@@ -59,7 +59,7 @@ type ServerMap map[string]protocol.Server
 
 func (c *Config) Add(protocol string, factory ServerFactory) {
 	if fac := c.configMap[protocol]; fac != nil {
-		hlog.Warnf("HERTZ: ServerFactory of protocol: %s will be overridden by customized function", protocol)
+		hlog.SystemLogger().Warnf("ServerFactory of protocol: %s will be overridden by customized function", protocol)
 	}
 	c.configMap[protocol] = factory
 }
diff --git a/pkg/route/engine.go b/pkg/route/engine.go
index 812e7f5..45ae38f 100644
--- a/pkg/route/engine.go
+++ b/pkg/route/engine.go
@@ -273,17 +273,17 @@ func (engine *Engine) Shutdown(ctx context.Context) (err error) {
 		// ensure that the hook is executed until wait timeout or finish
 		select {
 		case <-ctx.Done():
-			hlog.Infof("HERTZ: Execute OnShutdownHooks timeout: error=%v", ctx.Err())
+			hlog.SystemLogger().Infof("Execute OnShutdownHooks timeout: error=%v", ctx.Err())
 			return
 		case <-ch:
-			hlog.Info("HERTZ: Execute OnShutdownHooks finish")
+			hlog.SystemLogger().Info("Execute OnShutdownHooks finish")
 			return
 		}
 	}()
 
 	if opt := engine.options; opt != nil && opt.Registry != nil {
 		if err = opt.Registry.Deregister(opt.RegistryInfo); err != nil {
-			hlog.Errorf("HERTZ: Deregister error=%v", err)
+			hlog.SystemLogger().Errorf("Deregister error=%v", err)
 			return err
 		}
 	}
@@ -363,7 +363,7 @@ func (engine *Engine) alpnEnable() bool {
 }
 
 func (engine *Engine) listenAndServe() error {
-	hlog.Infof("HERTZ: Using network library=%s", GetTransporterName())
+	hlog.SystemLogger().Infof("Using network library=%s", GetTransporterName())
 	return engine.transport.ListenAndServe(engine.onData)
 }
 
@@ -383,7 +383,7 @@ func (engine *Engine) getNextProto(conn network.Conn) (proto string, err error)
 	if tlsConn, ok := conn.(network.ConnTLSer); ok {
 		if engine.options.ReadTimeout > 0 {
 			if err := conn.SetReadTimeout(engine.options.ReadTimeout); err != nil {
-				hlog.Errorf("HERTZ: BUG: error in SetReadDeadline=%s: error=%s", engine.options.ReadTimeout, err)
+				hlog.SystemLogger().Errorf("BUG: error in SetReadDeadline=%s: error=%s", engine.options.ReadTimeout, err)
 			}
 		}
 		err = tlsConn.Handshake()
@@ -431,7 +431,7 @@ func errProcess(conn io.Closer, err error) {
 		}
 	}
 	// other errors
-	hlog.Errorf("HERTZ: Error=%s, remoteAddr=%s", err.Error(), rip)
+	hlog.SystemLogger().Errorf("Error=%s, remoteAddr=%s", err.Error(), rip)
 }
 
 func getRemoteAddrFromCloser(conn io.Closer) string {
@@ -477,7 +477,7 @@ func (engine *Engine) Serve(c context.Context, conn network.Conn) (err error) {
 		if bytes.Equal(buf, bytestr.StrClientPreface) && engine.protocolServers[suite.HTTP2] != nil {
 			return engine.protocolServers[suite.HTTP2].Serve(c, conn)
 		}
-		hlog.Warnf("HERTZ: HTTP2 server is not loaded, request is going to fallback to HTTP1 server")
+		hlog.SystemLogger().Warnf("HTTP2 server is not loaded, request is going to fallback to HTTP1 server")
 	}
 
 	// ALPN path
@@ -569,7 +569,7 @@ func debugPrintRoute(httpMethod, absolutePath string, handlers app.HandlersChain
 	if handlerName == "" {
 		handlerName = utils.NameOfFunction(handlers.Last())
 	}
-	hlog.Debugf("HERTZ: Method=%-6s absolutePath=%-25s --> handlerName=%s (num=%d handlers)", httpMethod, absolutePath, handlerName, nuHandlers)
+	hlog.SystemLogger().Debugf("Method=%-6s absolutePath=%-25s --> handlerName=%s (num=%d handlers)", httpMethod, absolutePath, handlerName, nuHandlers)
 }
 
 func (engine *Engine) addRoute(method, path string, handlers app.HandlersChain) {
@@ -793,7 +793,7 @@ func (engine *Engine) LoadHTMLGlob(pattern string) {
 	if engine.options.AutoReloadRender {
 		files, err := filepath.Glob(pattern)
 		if err != nil {
-			hlog.Errorf("LoadHTMLGlob: %v", err)
+			hlog.SystemLogger().Errorf("LoadHTMLGlob: %v", err)
 			return
 		}
 		engine.SetAutoReloadHTMLTemplate(tmpl, files)


Test patch:
diff --git a/internal/bytesconv/bytesconv_32_test.go b/internal/bytesconv/bytesconv_32_test.go
new file mode 100644
index 0000000..384127f
--- /dev/null
+++ b/internal/bytesconv/bytesconv_32_test.go
@@ -0,0 +1,147 @@
+//go:build !amd64 && !arm64 && !ppc64
+// +build !amd64,!arm64,!ppc64
+
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015-present Aliaksandr Valialkin, VertaMedia, Kirill Danshin, Erik Dubbelboer, FastHTTP Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file may have been modified by CloudWeGo authors. All CloudWeGo
+ * Modifications are Copyright 2022 CloudWeGo Authors.
+ */
+
+package bytesconv
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/cloudwego/hertz/pkg/common/test/assert"
+)
+
+func TestWriteHexInt(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		n int
+	}{
+		{"0", 0},
+		{"1", 1},
+		{"123", 0x123},
+		{"7fffffff", 0x7fffffff},
+	} {
+		testWriteHexInt(t, v.n, v.s)
+	}
+}
+
+func TestReadHexInt(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		n int
+	}{
+		//errTooLargeHexNum "too large hex number"
+		//{"0123456789abcdef", -1},
+		{"0", 0},
+		{"fF", 0xff},
+		{"00abc", 0xabc},
+		{"7fffffff", 0x7fffffff},
+		{"000", 0},
+		{"1234ZZZ", 0x1234},
+	} {
+		testReadHexInt(t, v.s, v.n)
+	}
+}
+
+func TestParseUint(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		i int
+	}{
+		{"0", 0},
+		{"123", 123},
+		{"123456789", 123456789},
+		{"2147483647", 2147483647},
+	} {
+		n, err := ParseUint(S2b(v.s))
+		if err != nil {
+			t.Errorf("unexpected error: %v. s=%q n=%v", err, v.s, n)
+		}
+		assert.DeepEqual(t, n, v.i)
+	}
+}
+
+func TestParseUintError(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+	}{
+		{""},
+		{"cloudwego123"},
+		{"1234.545"},
+		{"-2147483648"},
+		{"2147483648"},
+		{"4294967295"},
+	} {
+		n, err := ParseUint(S2b(v.s))
+		if err == nil {
+			t.Fatalf("Expecting error when parsing %q. obtained %d", v.s, n)
+		}
+		if n >= 0 {
+			t.Fatalf("Unexpected n=%d when parsing %q. Expected negative num", n, v.s)
+		}
+	}
+}
+
+func TestAppendUint(t *testing.T) {
+	t.Parallel()
+
+	for _, s := range []struct {
+		n int
+	}{
+		{0},
+		{123},
+		{0x7fffffff},
+	} {
+		expectedS := fmt.Sprintf("%d", s.n)
+		s := AppendUint(nil, s.n)
+		assert.DeepEqual(t, expectedS, B2s(s))
+	}
+}
diff --git a/internal/bytesconv/bytesconv_64_test.go b/internal/bytesconv/bytesconv_64_test.go
new file mode 100644
index 0000000..6f96f8b
--- /dev/null
+++ b/internal/bytesconv/bytesconv_64_test.go
@@ -0,0 +1,149 @@
+//go:build amd64 || arm64 || ppc64
+// +build amd64 arm64 ppc64
+
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015-present Aliaksandr Valialkin, VertaMedia, Kirill Danshin, Erik Dubbelboer, FastHTTP Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file may have been modified by CloudWeGo authors. All CloudWeGo
+ * Modifications are Copyright 2022 CloudWeGo Authors.
+ */
+
+package bytesconv
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/cloudwego/hertz/pkg/common/test/assert"
+)
+
+func TestWriteHexInt(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		n int
+	}{
+		{"0", 0},
+		{"1", 1},
+		{"123", 0x123},
+		{"7fffffffffffffff", 0x7fffffffffffffff},
+	} {
+		testWriteHexInt(t, v.n, v.s)
+	}
+}
+
+func TestReadHexInt(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		n int
+	}{
+		//errTooLargeHexNum "too large hex number"
+		//{"0123456789abcdef", -1},
+		{"0", 0},
+		{"fF", 0xff},
+		{"00abc", 0xabc},
+		{"7fffffff", 0x7fffffff},
+		{"000", 0},
+		{"1234ZZZ", 0x1234},
+		{"7ffffffffffffff", 0x7ffffffffffffff},
+	} {
+		testReadHexInt(t, v.s, v.n)
+	}
+}
+
+func TestParseUint(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		i int
+	}{
+		{"0", 0},
+		{"123", 123},
+		{"1234567890", 1234567890},
+		{"123456789012345678", 123456789012345678},
+		{"9223372036854775807", 9223372036854775807},
+	} {
+		n, err := ParseUint(S2b(v.s))
+		if err != nil {
+			t.Errorf("unexpected error: %v. s=%q n=%v", err, v.s, n)
+		}
+		assert.DeepEqual(t, n, v.i)
+	}
+}
+
+func TestParseUintError(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+	}{
+		{""},
+		{"cloudwego123"},
+		{"1234.545"},
+		{"-9223372036854775808"},
+		{"9223372036854775808"},
+		{"18446744073709551615"},
+	} {
+		n, err := ParseUint(S2b(v.s))
+		if err == nil {
+			t.Fatalf("Expecting error when parsing %q. obtained %d", v.s, n)
+		}
+		if n >= 0 {
+			t.Fatalf("Unexpected n=%d when parsing %q. Expected negative num", n, v.s)
+		}
+	}
+}
+
+func TestAppendUint(t *testing.T) {
+	t.Parallel()
+
+	for _, s := range []struct {
+		n int
+	}{
+		{0},
+		{123},
+		{0x7fffffffffffffff},
+	} {
+		expectedS := fmt.Sprintf("%d", s.n)
+		s := AppendUint(nil, s.n)
+		assert.DeepEqual(t, expectedS, B2s(s))
+	}
+}
diff --git a/internal/bytesconv/bytesconv_test.go b/internal/bytesconv/bytesconv_test.go
index 57caea6..cf7a9a4 100644
--- a/internal/bytesconv/bytesconv_test.go
+++ b/internal/bytesconv/bytesconv_test.go
@@ -17,10 +17,14 @@
 package bytesconv
 
 import (
+	"net/url"
 	"testing"
 	"time"
 
+	"github.com/cloudwego/hertz/pkg/common/bytebufferpool"
 	"github.com/cloudwego/hertz/pkg/common/test/assert"
+	"github.com/cloudwego/hertz/pkg/common/test/mock"
+	"github.com/cloudwego/hertz/pkg/network"
 )
 
 func TestAppendDate(t *testing.T) {
@@ -46,7 +50,136 @@ func TestAppendDate(t *testing.T) {
 	} {
 		t.Run(c.name, func(t *testing.T) {
 			s := AppendHTTPDate(nil, c.date)
-			assert.DeepEqual(t, c.dateStr, string(s))
+			assert.DeepEqual(t, c.dateStr, B2s(s))
 		})
 	}
 }
+
+func TestLowercaseBytes(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		b1, b2 []byte
+	}{
+		{[]byte("CLOUDWEGO-HERTZ"), []byte("cloudwego-hertz")},
+		{[]byte("CLOUDWEGO"), []byte("cloudwego")},
+		{[]byte("HERTZ"), []byte("hertz")},
+	} {
+		LowercaseBytes(v.b1)
+		assert.DeepEqual(t, v.b2, v.b1)
+	}
+}
+
+// The test converts byte slice to a string without memory allocation.
+func TestB2s(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		b []byte
+	}{
+		{"cloudwego-hertz", []byte("cloudwego-hertz")},
+		{"cloudwego", []byte("cloudwego")},
+		{"hertz", []byte("hertz")},
+	} {
+		assert.DeepEqual(t, v.s, B2s(v.b))
+	}
+}
+
+// The test converts string to a byte slice without memory allocation.
+func TestS2b(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		s string
+		b []byte
+	}{
+		{"cloudwego-hertz", []byte("cloudwego-hertz")},
+		{"cloudwego", []byte("cloudwego")},
+		{"hertz", []byte("hertz")},
+	} {
+		assert.DeepEqual(t, S2b(v.s), v.b)
+	}
+}
+
+// common test function for 32bit and 64bit
+func testWriteHexInt(t *testing.T, n int, expectedS string) {
+	w := bytebufferpool.Get()
+	zw := network.NewWriter(w)
+	if err := WriteHexInt(zw, n); err != nil {
+		t.Errorf("unexpected error when writing hex %x: %v", n, err)
+	}
+	if err := zw.Flush(); err != nil {
+		t.Fatalf("unexpected error when flushing hex %x: %v", n, err)
+	}
+	s := B2s(w.B)
+	assert.DeepEqual(t, s, expectedS)
+}
+
+// common test function for 32bit and 64bit
+func testReadHexInt(t *testing.T, s string, expectedN int) {
+	zr := mock.NewZeroCopyReader(s)
+	n, err := ReadHexInt(zr)
+	if err != nil {
+		t.Errorf("unexpected error: %v. s=%q", err, s)
+	}
+	assert.DeepEqual(t, n, expectedN)
+}
+
+func TestAppendQuotedPath(t *testing.T) {
+	t.Parallel()
+
+	// Test all characters
+	pathSegment := make([]byte, 256)
+	for i := 0; i < 256; i++ {
+		pathSegment[i] = byte(i)
+	}
+	for _, s := range []struct {
+		path string
+	}{
+		{"/"},
+		{"//"},
+		{"/foo/bar"},
+		{"*"},
+		{"/foo/" + B2s(pathSegment)},
+	} {
+		u := url.URL{Path: s.path}
+		expectedS := u.EscapedPath()
+		res := B2s(AppendQuotedPath(nil, S2b(s.path)))
+		assert.DeepEqual(t, expectedS, res)
+	}
+}
+
+func TestAppendQuotedArg(t *testing.T) {
+	t.Parallel()
+
+	// Sync with url.QueryEscape
+	allcases := make([]byte, 256)
+	for i := 0; i < 256; i++ {
+		allcases[i] = byte(i)
+	}
+	res := B2s(AppendQuotedArg(nil, allcases))
+	expect := url.QueryEscape(B2s(allcases))
+	assert.DeepEqual(t, expect, res)
+}
+
+func TestParseHTTPDate(t *testing.T) {
+	t.Parallel()
+
+	for _, v := range []struct {
+		t string
+	}{
+		{"Thu, 04 Feb 2010 21:00:57 PST"},
+		{"Mon, 02 Jan 2006 15:04:05 MST"},
+	} {
+		t1, err := time.Parse(time.RFC1123, v.t)
+		if err != nil {
+			t.Fatalf("unexpected error: %v. t=%q", err, v.t)
+		}
+		t2, err := ParseHTTPDate(S2b(t1.Format(time.RFC1123)))
+		if err != nil {
+			t.Fatalf("unexpected error: %v. t=%q", err, v.t)
+		}
+		assert.DeepEqual(t, t1, t2)
+	}
+}
diff --git a/pkg/app/server/option_test.go b/pkg/app/server/option_test.go
index 861166c..c68e2c3 100644
--- a/pkg/app/server/option_test.go
+++ b/pkg/app/server/option_test.go
@@ -51,6 +51,8 @@ func TestOptions(t *testing.T) {
 		WithNetwork("unix"),
 		WithExitWaitTime(time.Second),
 		WithMaxKeepBodySize(500),
+		WithGetOnly(true),
+		WithKeepAlive(false),
 		WithTLS(nil),
 		WithH2C(true),
 		WithReadBufferSize(100),
@@ -76,6 +78,8 @@ func TestOptions(t *testing.T) {
 	assert.DeepEqual(t, opt.Network, "unix")
 	assert.DeepEqual(t, opt.ExitWaitTimeout, time.Second)
 	assert.DeepEqual(t, opt.MaxKeepBodySize, 500)
+	assert.DeepEqual(t, opt.GetOnly, true)
+	assert.DeepEqual(t, opt.DisableKeepalive, true)
 	assert.DeepEqual(t, opt.H2C, true)
 	assert.DeepEqual(t, opt.ReadBufferSize, 100)
 	assert.DeepEqual(t, opt.ALPN, true)
@@ -101,6 +105,8 @@ func TestDefaultOptions(t *testing.T) {
 	assert.DeepEqual(t, opt.StreamRequestBody, false)
 	assert.DeepEqual(t, opt.Addr, ":8888")
 	assert.DeepEqual(t, opt.MaxRequestBodySize, 4*1024*1024)
+	assert.DeepEqual(t, opt.GetOnly, false)
+	assert.DeepEqual(t, opt.DisableKeepalive, false)
 	assert.DeepEqual(t, opt.DisablePrintRoute, false)
 	assert.DeepEqual(t, opt.Network, "tcp")
 	assert.DeepEqual(t, opt.ExitWaitTimeout, time.Second*5)
diff --git a/pkg/network/dialer/dialer_test.go b/pkg/network/dialer/dialer_test.go
new file mode 100644
index 0000000..eb98969
--- /dev/null
+++ b/pkg/network/dialer/dialer_test.go
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dialer
+
+import (
+	"crypto/tls"
+	"errors"
+	"net"
+	"testing"
+	"time"
+
+	"github.com/cloudwego/hertz/pkg/common/test/assert"
+	"github.com/cloudwego/hertz/pkg/network"
+)
+
+func TestDialer(t *testing.T) {
+	SetDialer(&mockDialer{})
+	dialer := DefaultDialer()
+	assert.DeepEqual(t, &mockDialer{}, dialer)
+
+	_, err := AddTLS(nil, nil)
+	assert.NotNil(t, err)
+
+	_, err = DialConnection("", "", 0, nil)
+	assert.NotNil(t, err)
+
+	_, err = DialTimeout("", "", 0, nil)
+	assert.NotNil(t, err)
+}
+
+type mockDialer struct{}
+
+func (m *mockDialer) DialConnection(network, address string, timeout time.Duration, tlsConfig *tls.Config) (conn network.Conn, err error) {
+	return nil, errors.New("method not implement")
+}
+
+func (m *mockDialer) DialTimeout(network, address string, timeout time.Duration, tlsConfig *tls.Config) (conn net.Conn, err error) {
+	return nil, errors.New("method not implement")
+}
+
+func (m *mockDialer) AddTLS(conn network.Conn, tlsConfig *tls.Config) (network.Conn, error) {
+	return nil, errors.New("method not implement")
+}
diff --git a/pkg/network/netpoll/connection_test.go b/pkg/network/netpoll/connection_test.go
new file mode 100644
index 0000000..79dc80b
--- /dev/null
+++ b/pkg/network/netpoll/connection_test.go
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2022 CloudWeGo Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package netpoll
+
+import (
+	"errors"
+	"net"
+	"testing"
+	"time"
+
+	"github.com/cloudwego/hertz/pkg/common/test/assert"
+	"github.com/cloudwego/netpoll"
+)
+
+func TestReadBytes(t *testing.T) {
+	c := &mockConn{[]byte("a"), nil, 0}
+	conn := newConn(c)
+	assert.DeepEqual(t, 1, conn.Len())
+
+	b, _ := conn.Peek(1)
+	assert.DeepEqual(t, []byte{'a'}, b)
+
+	readByte, _ := conn.ReadByte()
+	assert.DeepEqual(t, byte('a'), readByte)
+
+	_, err := conn.ReadByte()
+	assert.DeepEqual(t, errors.New("readByte error: index out of range"), err)
+
+	c = &mockConn{[]byte("bcd"), nil, 0}
+	conn = newConn(c)
+
+	readBinary, _ := conn.ReadBinary(2)
+	assert.DeepEqual(t, []byte{'b', 'c'}, readBinary)
+
+	_, err = conn.ReadBinary(2)
+	assert.DeepEqual(t, errors.New("readBinary error: index out of range"), err)
+}
+
+func TestPeekRelease(t *testing.T) {
+	c := &mockConn{[]byte("abcdefg"), nil, 0}
+	conn := newConn(c)
+
+	// release the buf
+	conn.Release()
+	_, err := conn.Peek(1)
+	assert.DeepEqual(t, errors.New("peek error"), err)
+
+	assert.DeepEqual(t, errors.New("skip error"), conn.Skip(2))
+}
+
+func TestWriteLogin(t *testing.T) {
+	c := &mockConn{nil, []byte("abcdefg"), 0}
+	conn := newConn(c)
+	buf, _ := conn.Malloc(10)
+	assert.DeepEqual(t, 10, len(buf))
+	n, _ := conn.WriteBinary([]byte("abcdefg"))
+	assert.DeepEqual(t, 7, n)
+	assert.DeepEqual(t, errors.New("flush error"), conn.Flush())
+}
+
+func TestHandleSpecificError(t *testing.T) {
+	conn := &Conn{}
+	assert.DeepEqual(t, false, conn.HandleSpecificError(nil, ""))
+	assert.DeepEqual(t, true, conn.HandleSpecificError(netpoll.ErrConnClosed, ""))
+}
+
+type mockConn struct {
+	readBuf  []byte
+	writeBuf []byte
+	// index for the first readable byte in readBuf
+	off int
+}
+
+// mockConn's methods is simplified for unit test
+// Peek returns the next n bytes without advancing the reader
+func (m *mockConn) Peek(n int) (b []byte, err error) {
+	if m.off+n-1 < len(m.readBuf) {
+		return m.readBuf[m.off : m.off+n], nil
+	}
+	return nil, errors.New("peek error")
+}
+
+// Skip discards the next n bytes
+func (m *mockConn) Skip(n int) error {
+	if m.off+n < len(m.readBuf) {
+		m.off += n
+		return nil
+	}
+	return errors.New("skip error")
+}
+
+// Release the memory space occupied by all read slices
+func (m *mockConn) Release() error {
+	m.readBuf = nil
+	m.off = 0
+	return nil
+}
+
+// Len returns the total length of the readable data in the reader
+func (m *mockConn) Len() int {
+	return len(m.readBuf) - m.off
+}
+
+// ReadByte is used to read one byte with advancing the read pointer
+func (m *mockConn) ReadByte() (byte, error) {
+	if m.off < len(m.readBuf) {
+		m.off++
+		return m.readBuf[m.off-1], nil
+	}
+	return 0, errors.New("readByte error: index out of range")
+}
+
+// ReadBinary is used to read next n byte with copy, and the read pointer will be advanced
+func (m *mockConn) ReadBinary(n int) (b []byte, err error) {
+	if m.off+n < len(m.readBuf) {
+		m.off += n
+		return m.readBuf[m.off-n : m.off], nil
+	}
+	return nil, errors.New("readBinary error: index out of range")
+}
+
+// Malloc will provide a n bytes buffer to send data
+func (m *mockConn) Malloc(n int) (buf []byte, err error) {
+	m.writeBuf = make([]byte, n)
+	return m.writeBuf, nil
+}
+
+// WriteBinary will use the user buffer to flush
+func (m *mockConn) WriteBinary(b []byte) (n int, err error) {
+	return len(b), nil
+}
+
+// Flush will send data to the peer end
+func (m *mockConn) Flush() error {
+	return errors.New("flush error")
+}
+
+func (m *mockConn) HandleSpecificError(err error, rip string) (needIgnore bool) {
+	panic("implement me")
+}
+
+func (m *mockConn) Read(b []byte) (n int, err error) {
+	panic("implement me")
+}
+
+func (m *mockConn) Write(b []byte) (n int, err error) {
+	panic("implement me")
+}
+
+func (m *mockConn) Close() error {
+	panic("implement me")
+}
+
+func (m *mockConn) LocalAddr() net.Addr {
+	panic("implement me")
+}
+
+func (m *mockConn) RemoteAddr() net.Addr {
+	panic("implement me")
+}
+
+func (m *mockConn) SetDeadline(deadline time.Time) error {
+	panic("implement me")
+}
+
+func (m *mockConn) SetReadDeadline(deadline time.Time) error {
+	panic("implement me")
+}
+
+func (m *mockConn) SetWriteDeadline(deadline time.Time) error {
+	panic("implement me")
+}
+
+func (m *mockConn) Reader() netpoll.Reader {
+	panic("implement me")
+}
+
+func (m *mockConn) Writer() netpoll.Writer {
+	panic("implement me")
+}
+
+func (m *mockConn) IsActive() bool {
+	panic("implement me")
+}
+
+func (m *mockConn) SetReadTimeout(timeout time.Duration) error {
+	panic("implement me")
+}
+
+func (m *mockConn) SetIdleTimeout(timeout time.Duration) error {
+	panic("implement me")
+}
+
+func (m *mockConn) SetOnRequest(on netpoll.OnRequest) error {
+	panic("implement me")
+}
+
+func (m *mockConn) AddCloseCallback(callback netpoll.CloseCallback) error {
+	panic("implement me")
+}
diff --git a/pkg/network/standard/connection_test.go b/pkg/network/standard/connection_test.go
index 6909d9f..8108f1c 100644
--- a/pkg/network/standard/connection_test.go
+++ b/pkg/network/standard/connection_test.go
@@ -18,6 +18,8 @@ package standard
 
 import (
 	"bytes"
+	"crypto/tls"
+	"errors"
 	"io"
 	"net"
 	"strings"
@@ -231,8 +233,48 @@ func TestWriteLogic(t *testing.T) {
 	}
 }
 
+func TestInitializeConn(t *testing.T) {
+	c := mockConn{
+		localAddr: &mockAddr{
+			network: "tcp",
+			address: "192.168.0.10:80",
+		},
+		remoteAddr: &mockAddr{
+			network: "tcp",
+			address: "192.168.0.20:80",
+		},
+	}
+	conn := newConn(&c, 8192)
+	// check the assignment
+	assert.DeepEqual(t, errors.New("conn: write deadline not supported"), conn.SetDeadline(time.Time{}))
+	assert.DeepEqual(t, errors.New("conn: read deadline not supported"), conn.SetReadDeadline(time.Time{}))
+	assert.DeepEqual(t, errors.New("conn: write deadline not supported"), conn.SetWriteDeadline(time.Time{}))
+	assert.DeepEqual(t, errors.New("conn: read deadline not supported"), conn.SetReadTimeout(time.Duration(1)*time.Second))
+	assert.DeepEqual(t, errors.New("conn: read deadline not supported"), conn.SetReadTimeout(time.Duration(-1)*time.Second))
+	assert.DeepEqual(t, errors.New("conn: method not supported"), conn.Close())
+	assert.DeepEqual(t, &mockAddr{network: "tcp", address: "192.168.0.10:80"}, conn.LocalAddr())
+	assert.DeepEqual(t, &mockAddr{network: "tcp", address: "192.168.0.20:80"}, conn.RemoteAddr())
+}
+
+func TestInitializeTLSConn(t *testing.T) {
+	c := mockConn{}
+	tlsConn := newTLSConn(&c, 8192).(*TLSConn)
+	assert.DeepEqual(t, errors.New("conn: method not supported"), tlsConn.Handshake())
+	assert.DeepEqual(t, tls.ConnectionState{}, tlsConn.ConnectionState())
+}
+
 type mockConn struct {
-	buffer bytes.Buffer
+	buffer     bytes.Buffer
+	localAddr  net.Addr
+	remoteAddr net.Addr
+}
+
+func (m *mockConn) Handshake() error {
+	return errors.New("conn: method not supported")
+}
+
+func (m *mockConn) ConnectionState() tls.ConnectionState {
+	return tls.ConnectionState{}
 }
 
 func (m mockConn) Read(b []byte) (n int, err error) {
@@ -243,7 +285,6 @@ func (m mockConn) Read(b []byte) (n int, err error) {
 	if len(b) < 1024 {
 		return 100, nil
 	}
-
 	if len(b) < 5000 {
 		return 4096, nil
 	}
@@ -255,26 +296,42 @@ func (m *mockConn) Write(b []byte) (n int, err error) {
 	return m.buffer.Write(b)
 }
 
-func (m mockConn) Close() error {
-	panic("implement me")
+func (m *mockConn) Close() error {
+	return errors.New("conn: method not supported")
+}
+
+func (m *mockConn) LocalAddr() net.Addr {
+	return m.localAddr
+}
+
+func (m *mockConn) RemoteAddr() net.Addr {
+	return m.remoteAddr
+}
+
+func (m *mockConn) SetDeadline(deadline time.Time) error {
+	if err := m.SetWriteDeadline(deadline); err != nil {
+		return err
+	}
+	return m.SetWriteDeadline(deadline)
 }
 
-func (m mockConn) LocalAddr() net.Addr {
-	panic("implement me")
+func (m *mockConn) SetReadDeadline(deadline time.Time) error {
+	return errors.New("conn: read deadline not supported")
 }
 
-func (m mockConn) RemoteAddr() net.Addr {
-	panic("implement me")
+func (m *mockConn) SetWriteDeadline(deadline time.Time) error {
+	return errors.New("conn: write deadline not supported")
 }
 
-func (m mockConn) SetDeadline(t time.Time) error {
-	panic("implement me")
+type mockAddr struct {
+	network string
+	address string
 }
 
-func (m mockConn) SetReadDeadline(t time.Time) error {
-	panic("implement me")
+func (m *mockAddr) Network() string {
+	return m.network
 }
 
-func (m mockConn) SetWriteDeadline(t time.Time) error {
-	panic("implement me")
+func (m *mockAddr) String() string {
+	return m.address
 }
diff --git a/pkg/protocol/args_test.go b/pkg/protocol/args_test.go
index e63e4c9..6a613dc 100644
--- a/pkg/protocol/args_test.go
+++ b/pkg/protocol/args_test.go
@@ -43,6 +43,8 @@ package protocol
 
 import (
 	"testing"
+
+	"github.com/cloudwego/hertz/pkg/common/test/assert"
 )
 
 func TestArgsDeleteAll(t *testing.T) {
@@ -58,3 +60,72 @@ func TestArgsDeleteAll(t *testing.T) {
 		t.Fatalf("Expected q1 arg to be completely deleted. Current Args: %s", a.String())
 	}
 }
+
+func TestArgsBytesOperation(t *testing.T) {
+	var a Args
+	a.Add("q1", "foo")
+	a.Add("q2", "bar")
+	setArgBytes(a.args, a.args[0].key, a.args[0].value, false)
+	assert.DeepEqual(t, []byte("foo"), peekArgBytes(a.args, []byte("q1")))
+	setArgBytes(a.args, a.args[1].key, a.args[1].value, true)
+	assert.DeepEqual(t, []byte(""), peekArgBytes(a.args, []byte("q2")))
+}
+
+func TestArgsPeekExists(t *testing.T) {
+	var a Args
+	a.Add("q1", "foo")
+	a.Add("", "")
+	a.Add("?", "=")
+	v1, b1 := a.PeekExists("q1")
+	assert.DeepEqual(t, []byte("foo"), []byte(v1))
+	assert.True(t, b1)
+	v2, b2 := a.PeekExists("")
+	assert.DeepEqual(t, []byte(""), []byte(v2))
+	assert.True(t, b2)
+	v3, b3 := a.PeekExists("q3")
+	assert.DeepEqual(t, "", v3)
+	assert.False(t, b3)
+	v4, b4 := a.PeekExists("?")
+	assert.DeepEqual(t, "=", v4)
+	assert.True(t, b4)
+}
+
+func TestSetArg(t *testing.T) {
+	a := Args{args: setArg(nil, "q1", "foo", true)}
+	a.Add("", "")
+	setArgBytes(a.args, []byte("q3"), []byte("bar"), false)
+	s := a.String()
+	assert.DeepEqual(t, []byte("q1&="), []byte(s))
+}
+
+// Test the encoding of special parameters
+func TestArgsParseBytes(t *testing.T) {
+	var ta1 Args
+	ta1.Add("q1", "foo")
+	ta1.Add("q1", "bar")
+	ta1.Add("q2", "123")
+	ta1.Add("q3", "")
+	var a1 Args
+	a1.ParseBytes([]byte("q1=foo&q1=bar&q2=123&q3="))
+	assert.DeepEqual(t, &ta1, &a1)
+
+	var ta2 Args
+	ta2.Add("?", "foo")
+	ta2.Add("&", "bar")
+	ta2.Add("&", "?")
+	ta2.Add("=", "=")
+	var a2 Args
+	a2.ParseBytes([]byte("%3F=foo&%26=bar&%26=%3F&%3D=%3D"))
+	assert.DeepEqual(t, &ta2, &a2)
+}
+
+func TestArgsVisitAll(t *testing.T) {
+	var a Args
+	var s []string
+	a.Add("cloudwego", "hertz")
+	a.Add("hello", "world")
+	a.VisitAll(func(key, value []byte) {
+		s = append(s, string(key), string(value))
+	})
+	assert.DeepEqual(t, []string{"cloudwego", "hertz", "hello", "world"}, s)
+}
diff --git a/pkg/protocol/header_test.go b/pkg/protocol/header_test.go
index 9a75b3d..195da06 100644
--- a/pkg/protocol/header_test.go
+++ b/pkg/protocol/header_test.go
@@ -198,16 +198,16 @@ func TestCheckWriteHeaderCode(t *testing.T) {
 	buffer := bytes.NewBuffer(make([]byte, 0, 1024))
 	hlog.SetOutput(buffer)
 	checkWriteHeaderCode(99)
-	assert.True(t, strings.Contains(buffer.String(), "[Warn] Invalid StatusCode code"))
+	assert.True(t, strings.Contains(buffer.String(), "[Warn] HERTZ: Invalid StatusCode code"))
 	buffer.Reset()
 	checkWriteHeaderCode(600)
-	assert.True(t, strings.Contains(buffer.String(), "[Warn] Invalid StatusCode code"))
+	assert.True(t, strings.Contains(buffer.String(), "[Warn] HERTZ: Invalid StatusCode code"))
 	buffer.Reset()
 	checkWriteHeaderCode(100)
-	assert.False(t, strings.Contains(buffer.String(), "[Warn] Invalid StatusCode code"))
+	assert.False(t, strings.Contains(buffer.String(), "[Warn] HERTZ: Invalid StatusCode code"))
 	buffer.Reset()
 	checkWriteHeaderCode(599)
-	assert.False(t, strings.Contains(buffer.String(), "[Warn] Invalid StatusCode code"))
+	assert.False(t, strings.Contains(buffer.String(), "[Warn] HERTZ: Invalid StatusCode code"))
 }
 
 func TestResponseHeaderAdd(t *testing.T) {
diff --git a/pkg/protocol/request_test.go b/pkg/protocol/request_test.go
index 47e415d..745b51d 100644
--- a/pkg/protocol/request_test.go
+++ b/pkg/protocol/request_test.go
@@ -71,6 +71,51 @@ func TestMultiForm(t *testing.T) {
 	fmt.Println(err)
 }
 
+func TestRequestBodyWriterWrite(t *testing.T) {
+	w := requestBodyWriter{&Request{}}
+	w.Write([]byte("test"))
+	assert.DeepEqual(t, "test", string(w.r.body.B))
+}
+
+func TestRequestScheme(t *testing.T) {
+	req := NewRequest("", "ptth://127.0.0.1:8080", nil)
+	assert.DeepEqual(t, "ptth", string(req.Scheme()))
+	req = NewRequest("", "127.0.0.1:8080", nil)
+	assert.DeepEqual(t, "http", string(req.Scheme()))
+	assert.DeepEqual(t, true, req.IsURIParsed())
+}
+
+func TestRequestHost(t *testing.T) {
+	req := &Request{}
+	req.SetHost("127.0.0.1:8080")
+	assert.DeepEqual(t, "127.0.0.1:8080", string(req.Host()))
+}
+
+func TestRequestSwapBody(t *testing.T) {
+	reqA := &Request{}
+	reqA.SetBodyRaw([]byte("testA"))
+	reqB := &Request{}
+	reqB.SetBodyRaw([]byte("testB"))
+	SwapRequestBody(reqA, reqB)
+	assert.DeepEqual(t, "testA", string(reqB.bodyRaw))
+	assert.DeepEqual(t, "testB", string(reqA.bodyRaw))
+	reqA.SetBody([]byte("testA"))
+	reqB.SetBody([]byte("testB"))
+	SwapRequestBody(reqA, reqB)
+	assert.DeepEqual(t, "testA", string(reqB.body.B))
+	assert.DeepEqual(t, "", string(reqB.bodyRaw))
+	assert.DeepEqual(t, "testB", string(reqA.body.B))
+	assert.DeepEqual(t, "", string(reqA.bodyRaw))
+	reqA.SetBodyStream(strings.NewReader("testA"), len("testA"))
+	reqB.SetBodyStream(strings.NewReader("testB"), len("testB"))
+	SwapRequestBody(reqA, reqB)
+	body := make([]byte, 5)
+	reqB.bodyStream.Read(body)
+	assert.DeepEqual(t, "testA", string(body))
+	reqA.bodyStream.Read(body)
+	assert.DeepEqual(t, "testB", string(body))
+}
+
 func TestRequestKnownSizeStreamMultipartFormWithFile(t *testing.T) {
 	t.Parallel()
 
@@ -94,8 +139,9 @@ tailfoobar`
 	r := NewRequest("POST", "/upload", mr)
 	r.Header.SetContentLength(521)
 	r.Header.SetContentTypeBytes([]byte("multipart/form-data; boundary=----WebKitFormBoundaryJwfATyF8tmxSJnLg"))
-
+	assert.DeepEqual(t, false, r.HasMultipartForm())
 	f, err := r.MultipartForm()
+	assert.DeepEqual(t, true, r.HasMultipartForm())
 	if err != nil {
 		t.Fatalf("unexpected error: %s", err)
 	}
@@ -147,6 +193,10 @@ tailfoobar`
 			t.Fatalf("unexpected content-type %q. Expecting %q", ct, "application/octet-stream")
 		}
 	}
+
+	firstFile, err := r.FormFile("fileaaa")
+	assert.DeepEqual(t, "TODO", firstFile.Filename)
+	assert.Nil(t, err)
 }
 
 func TestRequestUnknownSizeStreamMultipartFormWithFile(t *testing.T) {
@@ -300,6 +350,117 @@ tailfoobar`
 	}
 }
 
+func TestRequestMultipartFormBoundary(t *testing.T) {
+	r := &Request{}
+	r.SetMultipartFormBoundary("----boundary----")
+	assert.DeepEqual(t, "----boundary----", r.MultipartFormBoundary())
+}
+
+func TestRequestSetQueryString(t *testing.T) {
+	r := &Request{}
+	r.SetQueryString("test")
+	assert.DeepEqual(t, "test", string(r.URI().queryString))
+}
+
+func TestRequestSetFormData(t *testing.T) {
+	r := &Request{}
+	data := map[string]string{"username": "admin"}
+	r.SetFormData(data)
+	assert.DeepEqual(t, "username", string(r.postArgs.args[0].key))
+	assert.DeepEqual(t, "admin", string(r.postArgs.args[0].value))
+	assert.DeepEqual(t, true, r.parsedPostArgs)
+	assert.DeepEqual(t, "application/x-www-form-urlencoded", string(r.Header.contentType))
+
+	r = &Request{}
+	value := map[string][]string{"item": {"apple", "peach"}}
+	r.SetFormDataFromValues(value)
+	assert.DeepEqual(t, "item", string(r.postArgs.args[0].key))
+	assert.DeepEqual(t, "apple", string(r.postArgs.args[0].value))
+	assert.DeepEqual(t, "item", string(r.postArgs.args[1].key))
+	assert.DeepEqual(t, "peach", string(r.postArgs.args[1].value))
+}
+
+func TestRequestSetFile(t *testing.T) {
+	r := &Request{}
+	r.SetFile("file", "/usr/bin/test.txt")
+	assert.DeepEqual(t, &File{"/usr/bin/test.txt", "file", nil}, r.multipartFiles[0])
+
+	files := map[string]string{"f1": "/usr/bin/test1.txt"}
+	r.SetFiles(files)
+	assert.DeepEqual(t, &File{"/usr/bin/test1.txt", "f1", nil}, r.multipartFiles[1])
+
+	assert.DeepEqual(t, []*File{{"/usr/bin/test.txt", "file", nil}, {"/usr/bin/test1.txt", "f1", nil}}, r.MultipartFiles())
+}
+
+func TestRequestSetFileReader(t *testing.T) {
+	r := &Request{}
+	r.SetFileReader("file", "/usr/bin/test.txt", nil)
+	assert.DeepEqual(t, &File{"/usr/bin/test.txt", "file", nil}, r.multipartFiles[0])
+}
+
+func TestRequestSetMultipartFormData(t *testing.T) {
+	r := &Request{}
+	data := map[string]string{"item": "apple"}
+	r.SetMultipartFormData(data)
+	assert.DeepEqual(t, &MultipartField{"item", "", "", strings.NewReader("apple")}, r.multipartFields[0])
+
+	r = &Request{}
+	fields := []*MultipartField{{"item2", "", "", strings.NewReader("apple2")}, {"item3", "", "", strings.NewReader("apple3")}}
+	r.SetMultipartFields(fields...)
+	assert.DeepEqual(t, fields, r.MultipartFields())
+}
+
+func TestRequestSetBasicAuth(t *testing.T) {
+	r := &Request{}
+	r.SetBasicAuth("admin", "admin")
+	assert.DeepEqual(t, "Authorization", string(r.Header.h[0].key))
+	assert.DeepEqual(t, "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:admin")), string(r.Header.h[0].value))
+}
+
+func TestRequestSetAuthToken(t *testing.T) {
+	r := &Request{}
+	r.SetAuthToken("token")
+	assert.DeepEqual(t, "Authorization", string(r.Header.h[0].key))
+	assert.DeepEqual(t, "Bearer token", string(r.Header.h[0].value))
+
+	r = &Request{}
+	r.SetAuthSchemeToken("http", "token")
+	assert.DeepEqual(t, "Authorization", string(r.Header.h[0].key))
+	assert.DeepEqual(t, "http token", string(r.Header.h[0].value))
+}
+
+func TestRequestSetHeaders(t *testing.T) {
+	r := &Request{}
+	headers := map[string]string{"Key1": "value1"}
+	r.SetHeaders(headers)
+	assert.DeepEqual(t, "Key1", string(r.Header.h[0].key))
+	assert.DeepEqual(t, "value1", string(r.Header.h[0].value))
+}
+
+func TestRequestSetCookie(t *testing.T) {
+	r := &Request{}
+	r.SetCookie("cookie1", "cookie1")
+	assert.DeepEqual(t, "cookie1", string(r.Header.cookies[0].key))
+	assert.DeepEqual(t, "cookie1", string(r.Header.cookies[0].value))
+
+	r.SetCookies(map[string]string{"cookie2": "cookie2"})
+	assert.DeepEqual(t, "cookie2", string(r.Header.cookies[1].key))
+	assert.DeepEqual(t, "cookie2", string(r.Header.cookies[1].value))
+}
+
+func TestRequestPath(t *testing.T) {
+	r := NewRequest("POST", "/upload?test", nil)
+	assert.DeepEqual(t, "/upload", string(r.Path()))
+	assert.DeepEqual(t, "test", string(r.QueryString()))
+}
+
+func TestRequestConnectionClose(t *testing.T) {
+	r := NewRequest("POST", "/upload?test", nil)
+	assert.DeepEqual(t, false, r.ConnectionClose())
+	r.SetConnectionClose()
+	assert.DeepEqual(t, true, r.ConnectionClose())
+}
+
 func TestRequestBodyWriteToPlain(t *testing.T) {
 	t.Parallel()
 
@@ -395,6 +556,32 @@ func TestRequestResetBody(t *testing.T) {
 	assert.Nil(t, req.body)
 }
 
+func TestRequestConstructBodyStream(t *testing.T) {
+	r := &Request{}
+	b := []byte("test")
+	r.ConstructBodyStream(&bytebufferpool.ByteBuffer{B: b}, strings.NewReader("test"))
+	assert.DeepEqual(t, "test", string(r.body.B))
+	stream := make([]byte, 4)
+	r.bodyStream.Read(stream)
+	assert.DeepEqual(t, "test", string(stream))
+}
+
+func TestRequestPostArgs(t *testing.T) {
+	t.Parallel()
+
+	s := `username=admin&password=admin`
+	mr := strings.NewReader(s)
+	r := &Request{}
+	r.SetBodyStream(mr, len(s))
+	r.Header.contentType = []byte("application/x-www-form-urlencoded")
+	arg := r.PostArgs()
+	assert.DeepEqual(t, "username", string(arg.args[0].key))
+	assert.DeepEqual(t, "admin", string(arg.args[0].value))
+	assert.DeepEqual(t, "password", string(arg.args[1].key))
+	assert.DeepEqual(t, "admin", string(arg.args[1].value))
+	assert.DeepEqual(t, "username=admin&password=admin", string(r.PostArgString()))
+}
+
 func TestRequestMayContinue(t *testing.T) {
 	t.Parallel()
 
@@ -509,6 +696,12 @@ func TestRequestCopyToWithOptions(t *testing.T) {
 	assert.DeepEqual(t, true, reqCopy.options.IsSD())
 }
 
+func TestRequestSetMaxKeepBodySize(t *testing.T) {
+	r := &Request{}
+	r.SetMaxKeepBodySize(1024)
+	assert.DeepEqual(t, 1024, r.maxKeepBodySize)
+}
+
 func TestRequestGetBodyAfterGetBodyStream(t *testing.T) {
 	req := AcquireRequest()
 	req.SetBodyString("abc")
diff --git a/pkg/protocol/uri_test.go b/pkg/protocol/uri_test.go
index 9da05a7..9588734 100644
--- a/pkg/protocol/uri_test.go
+++ b/pkg/protocol/uri_test.go
@@ -42,7 +42,6 @@
 package protocol
 
 import (
-	"fmt"
 	"path/filepath"
 	"reflect"
 	"testing"
@@ -53,16 +52,162 @@ import (
 func TestURI_Username(t *testing.T) {
 	var req Request
 	req.SetRequestURI("http://user:pass@example.com/foo/bar")
-	uri := req.URI()
-	user1 := string(uri.username)
-	fmt.Printf("1--- uri:%s user:%s\n", uri.RequestURI(), user1)
+	u := req.URI()
+	user1 := string(u.Username())
 	req.Header.SetRequestURIBytes([]byte("/foo/bar"))
-	uri = req.URI()
-	user2 := string(uri.username)
-	fmt.Printf("2--- uri:%s user:%s\n", uri.RequestURI(), user2)
-	if user1 != user2 {
-		t.Fatal("user1 != user2")
-	}
+	u = req.URI()
+	user2 := string(u.Username())
+	assert.DeepEqual(t, user1, user2)
+
+	expectUser3 := "user3"
+	expectUser4 := "user4"
+
+	u.SetUsername(expectUser3)
+	user3 := string(u.Username())
+	assert.DeepEqual(t, expectUser3, user3)
+	u.SetUsername(expectUser4)
+	user4 := string(u.Username())
+	assert.DeepEqual(t, expectUser4, user4)
+
+	u.SetUsernameBytes([]byte(user3))
+	assert.DeepEqual(t, expectUser3, user3)
+	u.SetUsernameBytes([]byte(user4))
+	assert.DeepEqual(t, expectUser4, user4)
+}
+
+func TestURI_Password(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectPassword1 := "password1"
+	expectPassword2 := "password2"
+
+	u.SetPassword(expectPassword1)
+	password1 := string(u.Password())
+	assert.DeepEqual(t, expectPassword1, password1)
+	u.SetPassword(expectPassword2)
+	password2 := string(u.Password())
+	assert.DeepEqual(t, expectPassword2, password2)
+
+	u.SetPasswordBytes([]byte(password1))
+	assert.DeepEqual(t, expectPassword1, password1)
+	u.SetPasswordBytes([]byte(password2))
+	assert.DeepEqual(t, expectPassword2, password2)
+}
+
+func TestURI_Hash(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectHash1 := "hash1"
+	expectHash2 := "hash2"
+
+	u.SetHash(expectHash1)
+	hash1 := string(u.Hash())
+	assert.DeepEqual(t, expectHash1, hash1)
+	u.SetHash(expectHash2)
+	hash2 := string(u.Hash())
+	assert.DeepEqual(t, expectHash2, hash2)
+}
+
+func TestURI_QueryString(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectQueryString1 := "key1=value1&key2=value2"
+	expectQueryString2 := "key3=value3&key4=value4"
+
+	u.SetQueryString(expectQueryString1)
+	queryString1 := string(u.QueryString())
+	assert.DeepEqual(t, expectQueryString1, queryString1)
+	u.SetQueryString(expectQueryString2)
+	queryString2 := string(u.QueryString())
+	assert.DeepEqual(t, expectQueryString2, queryString2)
+}
+
+func TestURI_Path(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectPath1 := "/"
+	expectPath2 := "/path1"
+	expectPath3 := "/path3"
+
+	// When Path is not set, Path defaults to "/"
+	path1 := string(u.Path())
+	assert.DeepEqual(t, expectPath1, path1)
+
+	u.SetPath(expectPath2)
+	path2 := string(u.Path())
+	assert.DeepEqual(t, expectPath2, path2)
+	u.SetPath(expectPath3)
+	path3 := string(u.Path())
+	assert.DeepEqual(t, expectPath3, path3)
+
+	u.SetPathBytes([]byte(path2))
+	assert.DeepEqual(t, expectPath2, path2)
+	u.SetPathBytes([]byte(path3))
+	assert.DeepEqual(t, expectPath3, path3)
+}
+
+func TestURI_Scheme(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectScheme1 := "scheme1"
+	expectScheme2 := "scheme2"
+
+	u.SetScheme(expectScheme1)
+	scheme1 := string(u.Scheme())
+	assert.DeepEqual(t, expectScheme1, scheme1)
+	u.SetScheme(expectScheme2)
+	scheme2 := string(u.Scheme())
+	assert.DeepEqual(t, expectScheme2, scheme2)
+
+	u.SetSchemeBytes([]byte(scheme1))
+	assert.DeepEqual(t, expectScheme1, scheme1)
+	u.SetSchemeBytes([]byte(scheme2))
+	assert.DeepEqual(t, expectScheme2, scheme2)
+}
+
+func TestURI_Host(t *testing.T) {
+	u := AcquireURI()
+	defer ReleaseURI(u)
+
+	expectHost1 := "host1"
+	expectHost2 := "host2"
+
+	u.SetHost(expectHost1)
+	host1 := string(u.Host())
+	assert.DeepEqual(t, expectHost1, host1)
+	u.SetHost(expectHost2)
+	host2 := string(u.Host())
+	assert.DeepEqual(t, expectHost2, host2)
+
+	u.SetHostBytes([]byte(host1))
+	assert.DeepEqual(t, expectHost1, host1)
+	u.SetHostBytes([]byte(host2))
+	assert.DeepEqual(t, expectHost2, host2)
+}
+
+func TestURI_PathOriginal(t *testing.T) {
+	var u URI
+	expectPath := "/path"
+	u.Parse(nil, []byte(expectPath))
+	uri := string(u.PathOriginal())
+	assert.DeepEqual(t, expectPath, uri)
+}
+
+func TestArgsKV_Get(t *testing.T) {
+	var argsKV argsKV
+	expectKey := "key"
+	expectValue := "value"
+	argsKV.key = []byte(expectKey)
+	argsKV.value = []byte(expectValue)
+	key := string(argsKV.GetKey())
+	value := string(argsKV.GetValue())
+	assert.DeepEqual(t, expectKey, key)
+	assert.DeepEqual(t, expectValue, value)
 }
 
 func TestURICopyToQueryArgs(t *testing.T) {
@@ -79,6 +224,7 @@ func TestURICopyToQueryArgs(t *testing.T) {
 	if string(a1.Peek("foo")) != "bar" {
 		t.Fatalf("unexpected query args value %q. Expecting %q", a1.Peek("foo"), "bar")
 	}
+	assert.DeepEqual(t, "bar", string(a1.Peek("foo")))
 }
 
 func TestURICopyTo(t *testing.T) {
@@ -112,9 +258,7 @@ func testURILastPathSegment(t *testing.T, path, expectedSegment string) {
 	var u URI
 	u.SetPath(path)
 	segment := u.LastPathSegment()
-	if string(segment) != expectedSegment {
-		t.Fatalf("unexpected last path segment for path %q: %q. Expecting %q", path, segment, expectedSegment)
-	}
+	assert.DeepEqual(t, expectedSegment, string(segment))
 }
 
 func TestURIPathEscape(t *testing.T) {
@@ -157,18 +301,14 @@ func testURIUpdate(t *testing.T, base, update, result string) {
 	u.Parse(nil, []byte(base))
 	u.Update(update)
 	s := u.String()
-	if s != result {
-		t.Fatalf("unexpected result %q. Expecting %q. base=%q, update=%q", s, result, base, update)
-	}
+	assert.DeepEqual(t, result, s)
 }
 
 func testURIPathEscape(t *testing.T, path, expectedRequestURI string) {
 	var u URI
 	u.SetPath(path)
 	requestURI := u.RequestURI()
-	if string(requestURI) != expectedRequestURI {
-		t.Fatalf("unexpected requestURI %q. Expecting %q. path %q", requestURI, expectedRequestURI, path)
-	}
+	assert.DeepEqual(t, expectedRequestURI, string(requestURI))
 }
 
 func TestDelArgs(t *testing.T) {
@@ -210,9 +350,7 @@ func TestURIFullURI(t *testing.T) {
 	u.Parse([]byte("google.com"), []byte("/foo?bar=baz&baraz#qqqq"))
 	uri := u.FullURI()
 	expectedURI := "http://google.com/foo?bar=baz&baraz#qqqq"
-	if string(uri) != expectedURI {
-		t.Fatalf("Unexpected URI: %q. Expected %q", uri, expectedURI)
-	}
+	assert.DeepEqual(t, expectedURI, string(uri))
 }
 
 func testURIFullURI(t *testing.T, scheme, host, path, hash string, args *Args, expectedURI string) {
@@ -225,9 +363,7 @@ func testURIFullURI(t *testing.T, scheme, host, path, hash string, args *Args, e
 	args.CopyTo(u.QueryArgs())
 
 	uri := u.FullURI()
-	if string(uri) != expectedURI {
-		t.Fatalf("Unexpected URI: %q. Expected %q", uri, expectedURI)
-	}
+	assert.DeepEqual(t, expectedURI, string(uri))
 }
 
 func TestParsePathWindows(t *testing.T) {
@@ -246,3 +382,27 @@ func testParsePathWindows(t *testing.T, path, expectedPath string) {
 		t.Fatalf("Unexpected Path: %q. Expected %q", parsedPath, expectedPath)
 	}
 }
+
+func TestParseHostWithStr(t *testing.T) {
+	expectUsername := "username"
+	expectPassword := "password"
+
+	testParseHostWithStr(t, "username", "", "")
+	testParseHostWithStr(t, "username@", expectUsername, "")
+	testParseHostWithStr(t, "username:password@", expectUsername, expectPassword)
+	testParseHostWithStr(t, ":password@", "", expectPassword)
+	testParseHostWithStr(t, ":password", "", "")
+}
+
+func testParseHostWithStr(t *testing.T, host, expectUsername, expectPassword string) {
+	var u URI
+	u.Parse([]byte(host), nil)
+	assert.DeepEqual(t, expectUsername, string(u.Username()))
+	assert.DeepEqual(t, expectPassword, string(u.Password()))
+}
+
+func TestParseURI(t *testing.T) {
+	expectURI := "http://google.com/foo?bar=baz&baraz#qqqq"
+	uri := string(ParseURI(expectURI).FullURI())
+	assert.DeepEqual(t, expectURI, uri)
+}