-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make some optimizations for http_conn.go #1059
Conversation
Signed-off-by: Tian <tianpengwei@baidu.com>
make some optimizations for http_conn.go
Better to test cover them :-) |
@@ -275,6 +275,7 @@ func (c *conn) serve() { | |||
var hl *bfe_module.HandlerList | |||
var retVal int | |||
session := c.session | |||
c.session.Proto = "http" // init proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的初始值可能是错的。
合理的做法:
- A. 暂保持未知值(在不影响其它功能的前提下,等到合适的时机设置)
- B. 采用以下方式判断
tlsConn, isTlsConn := c.rwc.(*bfe_tls.Conn)
if !isTlsConn {
c.session.Proto = "http"
}
@@ -316,6 +317,7 @@ func (c *conn) serve() { | |||
} | |||
|
|||
if tlsConn, ok := c.rwc.(*bfe_tls.Conn); ok { | |||
c.session.Proto = "https" // update proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里设置初始值也有可能是错的.
建议:
- 将line 320 移动到 line 381
- if 条件改为 if isTlsConn
Tian seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #1059 +/- ##
===========================================
- Coverage 54.37% 54.36% -0.01%
===========================================
Files 302 302
Lines 26704 26702 -2
===========================================
- Hits 14520 14517 -3
+ Misses 10520 10518 -2
- Partials 1664 1667 +3 ☔ View full report in Codecov by Sentry. |
This operation is performed twice,”c.rwc.(*bfe_tls.Conn) “