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

fix(server): prohibit the length headers on successful CONNECT #1784

Merged

Conversation

ubnt-intrepid
Copy link
Contributor

fixes #1783.

@seanmonstar
Copy link
Member

Thanks! Out of curiosity, do you know if the additional branches affect performance much? Likely the ones with least noise are in proto::h1::role at the bottom of the file.

@ubnt-intrepid
Copy link
Contributor Author

The benchmark result on my environment:

master:

test proto::h1::role::tests::bench_parse_incoming               ... bench:       3,199 ns/iter (+/- 1,142) = 274 MB/s
test proto::h1::role::tests::bench_parse_short                  ... bench:         282 ns/iter (+/- 10) = 141 MB/s
test proto::h1::role::tests::bench_server_encode_headers_preset ... bench:         246 ns/iter (+/- 13) = 439 MB/s
test proto::h1::role::tests::bench_server_encode_no_headers     ... bench:          34 ns/iter (+/- 0) = 2235 MB/s

this PR:

test proto::h1::role::tests::bench_parse_incoming               ... bench:       3,229 ns/iter (+/- 1,014) = 271 MB/s
test proto::h1::role::tests::bench_parse_short                  ... bench:         286 ns/iter (+/- 6) = 139 MB/s
test proto::h1::role::tests::bench_server_encode_headers_preset ... bench:         256 ns/iter (+/- 20) = 421 MB/s
test proto::h1::role::tests::bench_server_encode_no_headers     ... bench:          34 ns/iter (+/- 0) = 2235 MB/s

@seanmonstar
Copy link
Member

Oh yea, so it does affect slightly bench_server_encode_headers_preset. Since this condition should be very rare, I think we can structure the change so that the normal case doesn't see any extra branches.

src/proto/h1/role.rs Outdated Show resolved Hide resolved
@ubnt-intrepid ubnt-intrepid force-pushed the ignore-content-length-on-connect branch from bfe48c9 to f9073a9 Compare March 20, 2019 04:36
@ubnt-intrepid ubnt-intrepid changed the title fix(server): ignore Transfer-Encoding and Content-Length on CONNECT fix(server): prohibit the length headers on successful CONNECT Mar 20, 2019
@ubnt-intrepid
Copy link
Contributor Author

Fixed the patch to make the number of branch to be the same as the original.

benchmark result master:
test proto::h1::role::tests::bench_parse_incoming               ... bench:       3,176 ns/iter (+/- 74) = 276 MB/s
test proto::h1::role::tests::bench_parse_short                  ... bench:         280 ns/iter (+/- 4) = 142 MB/s
test proto::h1::role::tests::bench_server_encode_headers_preset ... bench:         259 ns/iter (+/- 30) = 416 MB/s
test proto::h1::role::tests::bench_server_encode_no_headers     ... bench:          34 ns/iter (+/- 0) = 2235 MB/s

this PR:

test proto::h1::role::tests::bench_parse_incoming               ... bench:       3,193 ns/iter (+/- 107) = 274 MB/s
test proto::h1::role::tests::bench_parse_short                  ... bench:         280 ns/iter (+/- 8) = 142 MB/s
test proto::h1::role::tests::bench_server_encode_headers_preset ... bench:         245 ns/iter (+/- 20) = 440 MB/s
test proto::h1::role::tests::bench_server_encode_no_headers     ... bench:          34 ns/iter (+/- 0) = 2235 MB/s

@seanmonstar seanmonstar merged commit d1501a0 into hyperium:master Mar 20, 2019
@seanmonstar
Copy link
Member

Thanks!

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.

Server should not send Content-Length or Transfer-Encoding on successful CONNECT
2 participants