Skip to content
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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

Tovi163
Copy link
Collaborator

@Tovi163 Tovi163 commented Jun 29, 2022

This operation is performed twice,”c.rwc.(*bfe_tls.Conn) “

@kwanhur
Copy link
Contributor

kwanhur commented Jun 30, 2022

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里设置初始值也有可能是错的.

建议:

  1. 将line 320 移动到 line 381
  2. if 条件改为 if isTlsConn

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Tian
❌ Tovi163


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-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 54.36%. Comparing base (1c4a923) to head (0e137a0).

❗ Current head 0e137a0 differs from pull request most recent head aa5f761. Consider uploading reports for the commit aa5f761 to get more accurate results

Files Patch % Lines
bfe_server/http_conn.go 0.00% 3 Missing ⚠️

❗ 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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants