Commit graph

65 commits

Author SHA1 Message Date
ewang
3132afe77b Add a convenience function to retrieve Session digest 2024-04-22 08:25:49 -07:00
ewang
d9e8fe9017 Add body_bytes_read() method to Session
Add an API to retrieve request body bytes read so far.
2024-04-22 08:25:49 -07:00
Matthew Gumport
f49185d32c fix tinylfu test flake
The TinyLFU test was failing for changes unrelated to anything in the tinyufo
crate. This changes the test to stop that! What was occurring was expected
behavior, so the test is what's changing instead of any internal logic.

What was happening were hash collisions in the bloom filter used by the
estimator. Instead of asserting that we'd always start counting from 0, we now
allow for this in the test by `get()`ing first, then comparing relative
values. For the final comparisons, we check that values are greater-than or
equal-to their lower bound as determined by the number of `incr()`s we called on
their keys.
2024-04-22 08:25:49 -07:00
Xiaobo Liu
2e81e14760 lru: using max to simplify the if statement
Includes-commit: 6d2613d254
Replicated-from: https://github.com/cloudflare/pingora/pull/130
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2024-04-22 08:25:49 -07:00
Matthew Gumport
9fe99de729 add edition to .rustfmt.toml
My editor was defaulting to using the 2015 edition of the parser since that's
the default for an unset edition in fmt file. This fixes that by specifying that
we want to use the same edition for formatting that we do everywhere else.
2024-04-22 08:25:49 -07:00
Matthew Gumport
ca73fd73f1 address string interpolation outside of proper context
https://github.com/cloudflare/pingora/issues/181

Ran:
```
rg --pcre2 '(?<!(trace\!\()|(println\!\()|(warn\!\()|(info\!\()|(debug\!\()|(format\!\()|(error\!\()|(write\!\()|(panic\!\())\".*\{.+\"'
```

and audited the 200+ results by hand. Only messed up in a few places!

Hat-tip to Kevin for helping me understand the compile error messages I was
seeing trying to fix this naively.
2024-04-22 08:25:49 -07:00
Kevin Guthrie
75859b01fe Fix #186 Expose Bucket to prevent compile error in Rust <= 1.73 2024-04-22 08:25:49 -07:00
Yesterday17
fec2f1e5e6 Replace splitn(2) with split_once
---
Do not trim value

Includes-commit: 7431d24402
Includes-commit: fdf61307a3
Replicated-from: https://github.com/cloudflare/pingora/pull/177
2024-04-22 08:25:49 -07:00
JiajunDu
4a9c9fa4ea Fix the counting problem of used_weight data field in LruUnit<T>
https://github.com/cloudflare/pingora/issues/164

Includes-commit: af11b964e8
Replicated-from: https://github.com/cloudflare/pingora/pull/174
Signed-off-by: JiajunDu <wonderboy512@163.com>
2024-04-22 08:25:49 -07:00
gengteng
5ea8c46696 feat: Change Server::run_forever to take ownership and ensure exit semantics
Includes-commit: b83da0f03e
Replicated-from: https://github.com/cloudflare/pingora/pull/176
2024-04-22 08:25:47 -07:00
atamakahere
7ea2ac970a refactor: estimator::Estimator::new
---
refactor: estimator::Estimator::reset
---
test: add test for Estimator::Reset
---
refactor: use iter in estimator

Includes-commit: 052d825fcc
Includes-commit: 3f730eb4d7
Includes-commit: b2fec3cc51
Includes-commit: d1906805e8
Replicated-from: https://github.com/cloudflare/pingora/pull/16
2024-04-22 08:25:05 -07:00
Y.Shing
7ce6f4ac1c fix cargo run --example server, missing cert
Includes-commit: 63f144be66
Replicated-from: https://github.com/cloudflare/pingora/pull/116
2024-04-12 15:43:32 -07:00
Andrew Hauck
fca0532950 Add tls upstream support for SSLKEYLOG to allow decryption of traffic for debugging purposes 2024-04-12 15:43:32 -07:00
Yuchen Wu
61b046bb5b RUSTSEC-2024-0332: bump h2 2024-04-12 15:30:28 -07:00
ewang
3f682ea37f Add cache_not_modified_filter, handle etag/last-modified
This filter allows customizing the `ETag`/`Last-Modified` check to see
if the proxy cache can return 304 Not Modified instead of the full
response.

Also flesh out the `ETag`/`Last-Modified` handling in the base
`not_modified_filter` with `If-None-Match` and `If-Modified-Since`.
2024-04-12 15:30:28 -07:00
Kevin Guthrie
acee67f870 Adding 0.1.1 changelog 2024-04-05 15:51:07 -04:00
Gustav Davidsson
881db9e32c Add/polish some comments 2024-04-05 11:46:20 -07:00
ewang
f54d17a339 Clarify cache-control regex comments
Also update a few comment links for the newest HTTP RFCs.
2024-04-05 11:46:20 -07:00
Yuchen Wu
dfcd3d1d9f Fix typos and grammar issues in docs
And other things.

Co-authored-by: DimanNe <causal.consistency@proton.me>
Co-authored-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: lilo <luolee.me@gmail.com>
Co-authored-by: Yang He <abruzzi.hraig@gmail.com>
2024-04-05 11:46:20 -07:00
Kevin Guthrie
3c5d99c3f4 Add the doc configuration that enables the nice docs about detailing which things are available on which features 2024-04-05 11:46:20 -07:00
ewang
c2d0c80495 Add ServerConf::merge_with_opt for when Opt/ServerConf are used together 2024-04-05 11:46:20 -07:00
ewang
9156ea7d5b Add doc comments for unstable fields in ServerConf 2024-04-05 11:46:20 -07:00
James Munns
b02729272a Expose currently pub(crate) configuration options, provide new Server constructor
---
Also expose the Version field

Includes-commit: acbc9e533b
Includes-commit: d8fb7dbe75
Replicated-from: https://github.com/cloudflare/pingora/pull/165
2024-04-05 11:46:20 -07:00
afon
aca70af5e5 Only compile pingora-openssl when openssl feature is enabled.
Replicated-from: https://github.com/cloudflare/pingora/pull/131
Includes-commit: ae706cdf49
2024-04-05 11:46:20 -07:00
Benjamin Halsted
b26d59983c Fix voldemort types in public interface
The `Fds` struct used in `ListenFds` in the `pingora::services::Service` trait
is not nameable. See https://rust-lang.github.io/rfcs/2145-type-privacy.html#~~~-voldemort-types-its-reachable-but-i-cant-name-it

This change makes both `ListenFds` and `Fds` public.

As a side-effect all of the methods on `Fds` are now public as well but are not documented.

Fixes: https://github.com/cloudflare/pingora/issues/145

Replicated-from: https://github.com/cloudflare/pingora/pull/146
Includes-commit: 6f835a357b
2024-04-05 11:46:20 -07:00
Matthew Gumport
d62826597b bleeper: ignore Dockerfile 2024-04-05 11:46:20 -07:00
Hiroaki Nakamura
c61b83b745 Add config for grace period and graceful shutdown timeout
---
test: initialize ServerConf with added new fields


Replicated-from: https://github.com/cloudflare/pingora/pull/99
Includes-commit: f0dc59aeae
Includes-commit: c37e63bdbe
2024-04-05 11:46:20 -07:00
Yuchen Wu
cc32316980 Allow response body to be modified. 2024-04-05 11:46:20 -07:00
Andrew Hauck
5bb90dcd67 Add example that routes to LB cluster based on request uri 2024-04-05 11:46:20 -07:00
Andrew Hauck
6a8196ba64 Use escape_default() and limit the buffer size for InvalidHTTPHeader errors when reading requests 2024-04-05 11:46:20 -07:00
pluveto
59a9f93bd6 tests(cache): add tests for purge method
Replicated-from: https://github.com/cloudflare/pingora/pull/18
Includes-commit: e5a3865e9d
Includes-commit: f4af9ad3a5
Includes-commit: bbfb1eb5ba
Includes-commit: f74cf9f82a
2024-04-05 11:46:20 -07:00
Matthew (mbg)
5fdf287c4d
dev: add dockerfile for local dev (#172)
There have been some comments about wanting an easier developer
experience, particularly on MacOS. This adds a Dockerfile which will
create an environment in which all tests can pass and will hopefully
make cross-platform development easier.

Solves #91
2024-03-29 11:08:34 -07:00
Gideon Tong
07f6854021
Fix typo in yaml file (#173) 2024-03-29 10:53:50 -07:00
Gideon Tong
6fbd360805 Add mark stale GitHub Action 2024-03-29 16:11:45 +00:00
Kevin Guthrie
0de54eb907 Refactoring external change to address code-review comments 2024-03-22 15:00:53 -07:00
gengteng
247ce6c4b0 feat: implement Keep-Alive header parsing in Session
Replicated-from: https://github.com/cloudflare/pingora/pull/24
Includes-commit: 357c1b95d9
2024-03-22 15:00:53 -07:00
Alexandre Antonio Juca
adba11a07a Fix typos and grammar issues
Update comment

Co-authored-by: Kevin Guthrie <kevin.guthrie@gmail.com>
Includes-commit: 61a55ae3fa
Includes-commit: 7da3e13d84
Replicated-from: https://github.com/cloudflare/pingora/pull/128
2024-03-22 15:00:42 -07:00
ewang
ff381fc3eb Require nix ~0.24.3 and chrono ~0.4.31 in Cargo.toml
These minor versions are required for the APIs used in pingora-core.
2024-03-22 15:00:42 -07:00
Yuchen Wu
f431624701 Correctly init body writer for upgraded requests
Before this change, the code tried to get the header from the stored
header which is only set after this function is called.
2024-03-22 15:00:42 -07:00
Yuchen Wu
2bfaf5b821 TinyUFO: add quick_cache for benchmarks
Add more cache crates to compare with.

Co-authored-by: Arthur Silva <arthurprs@gmail.com>
2024-03-22 15:00:29 -07:00
gengteng
558371c190 feat: Enhance Server::new to accept impl Into<Option<T>> for ergonomics
Replicated-from: https://github.com/cloudflare/pingora/pull/100
Includes-commit: 15cffed202
2024-03-22 14:26:16 -07:00
Yuchen Wu
ab86012c66 TinyUFO: add the option to use sharded skip list for storage
This option makes it more memory efficient but a bit slower.
2024-03-22 14:26:16 -07:00
zaidoon
b9d4428809 modernize ci 2024-03-22 10:50:10 -07:00
battmdpkq
8a84b24ad0 fix some comments
Signed-off-by: battmdpkq <cmaker@163.com>
Replicated-from: https://github.com/cloudflare/pingora/pull/123
Includes-commit: 943bedb281
2024-03-15 14:37:56 -07:00
Shane Utt
8963575ed2 chore: resolve TODOs in the pingora client example
Signed-off-by: Shane Utt <shaneutt@linux.com>
Replicated-from: https://github.com/cloudflare/pingora/pull/9
Includes-commit: 5833556e5f
2024-03-15 14:37:56 -07:00
ewang
20fd391f3e Add server_addr and client_addr to Session 2024-03-15 14:37:56 -07:00
Andrew Hauck
3e09114c4d Treat OS read timeouts as ReadError rather than ReadTimeout when reading http/1.1 response headers 2024-03-15 14:37:56 -07:00
Kevin Guthrie
d2c8118ef4 Adding bleeper config file to internal repo 2024-03-15 14:37:56 -07:00
Matthew Gumport
ae8ea771b1 compile and test cleanly with nightly
The vast majority of these are redundant imports.
2024-03-15 14:37:56 -07:00
afon
81e6adea4d Unify the type for matching verify_result 2024-03-15 14:37:56 -07:00