Commit graph

183 commits

Author SHA1 Message Date
Kevin Guthrie
24d722920a Derive Ord and PartialOrd for CompactCacheKey 2024-08-09 14:30:49 -07:00
Edward Wang
7003ac34ad Set stale-updating as an explicit CachePhase
This cache phase indicates when we are serving a stale cache hit, but
there is another request currently updating the asset.
2024-08-09 14:30:49 -07:00
v1xingyue
35810d6c92 add new_with_weight
---
use weight as param
---
fix format and doc comment
---
add ext as Extensions::new
---
Merge branch 'main' into ~~~

Includes-commit: 0d4a658cf8
Includes-commit: 1ee9b327b4
Includes-commit: 5b05294e24
Includes-commit: cf8faea7d0
Includes-commit: f0cefff7eb
Replicated-from: https://github.com/cloudflare/pingora/pull/333
2024-08-09 14:30:49 -07:00
Kevin Guthrie
76c4fdacbb Updating the rate-limiter documentation with a simpler example 2024-08-09 14:30:49 -07:00
xialeistudio
ef5ed1af3b docs: add docs for RateLimiter
---
Update docs/user_guide/ratelimiter.md
---
docs: add upstream_request_filter to fix forbidden error of RateLimiter
---
Update ratelimiter.md

update rate_limiter_map initialize code

Co-authored-by: Dany Gagnon <ddanygagnon@gmail.com>
Co-authored-by: Xia Lei <xialeistudio@gmail.com>
Includes-commit: 461d384966
Includes-commit: 80231711f9
Includes-commit: 99ed87f309
Includes-commit: bffc9f4f23
Replicated-from: https://github.com/cloudflare/pingora/pull/120
2024-08-09 14:30:49 -07:00
Edward Wang
e1c6e57db3 Add un-gzip support and allow decompress by algorithm 2024-08-09 14:30:49 -07:00
Edward Wang
e5fda7c657 Allow Stale phase in cache_miss
There could be a race condition where a Stale request waiting on cache
lock retries the cache lock and lookup, but enters cache_miss after
finding the asset is no longer present.
2024-08-09 14:30:49 -07:00
Nathan Prescott
e0ade326ed Updated flurry and quick_cache (flurry being the only relavent change)
---
Specified quick_cache version because older version was being loaded on build

Includes-commit: 3f5419e92d
Includes-commit: de83f0a612
Replicated-from: https://github.com/cloudflare/pingora/pull/248
2024-08-09 14:30:49 -07:00
Yuchen Wu
11b5882a42 Retry all h2 connection when encountering graceful shutdown
Before this change, the retry only happens on reused connections. The
shutting down could also happen on new connections as well. So this
change will retry in both cases.
2024-08-09 14:30:49 -07:00
Yuchen Wu
2a080423cd Use Rust 1.80 2024-08-09 14:30:49 -07:00
Yuchen Wu
9f50e6ccb0 Handle bare IPv6 address in raw connect Host 2024-08-09 14:30:49 -07:00
Yuchen Wu
29746f6968 Upgrade latest Rust to 1.80 2024-08-02 12:08:38 -07:00
Yuchen Wu
8af7348958 Allow unknown links 2024-07-26 13:35:13 -07:00
Yuchen Wu
32303b9258 Address Rust 1.80 clippy warnings.
Also remove the doc_async_trait cfg since it is no longer viable.
2024-07-26 13:35:13 -07:00
Yuchen Wu
ff2582a64a Fix a rebase merge error 2024-07-26 13:35:13 -07:00
Andrew Hauck
be97e35031 Add ability to ignore informational responses when proxying downstream 2024-07-26 13:35:13 -07:00
Yuchen Wu
999e379064 Support opaque extension field in Backend
Sometimes service dicovery can carry arbitrary information, such as
SNI and request path to instrument how to connect to backend servers.

Backend now support to carry this type of information.
2024-07-26 13:35:13 -07:00
Andrew Hauck
a51874039f Add callback function to Backends update() to address atomicity issue when building selector 2024-07-26 13:35:13 -07:00
Yuchen Wu
7c122e7f36 Add the support for custom L4 connector
This allows user defined L4 connect() to be used so that they can
customize the connect behavior such as changing socket options and
simulating errors in tests.
2024-07-26 13:35:13 -07:00
pluveto
60787db4a1 chore(openssl): Update OpenSSL function signatures to use *mut instead of *const
This PR updates the function signatures in the `ext.rs` file to use `*mut` instead of `*const` for the `ssl` and `cert` parameters in the `SSL_use_certificate` and `SSL_use_PrivateKey` functions. This indicates that the functions can modify the SSL and certificate objects as intended.

Ref:
- https://www.openssl.org/docs/man1.1.1/man3/SSL_use_certificate.html
https://boringssl.googlesource.com/boringssl/+/refs/tags/~~~/ssl/ssl_cert.cc#292

Refactor the `cvt` function to use `c_long` instead of `c_int` for the return type for better compatibility with the types used in the OpenSSL library.

Also, add a test case for the `ssl_set_groups_list` function to ensure it handles valid and invalid input correctly.
---
chore(openssl):fix increase X509 reference count

Includes-commit: 7841271b4a
Includes-commit: e132431889
Replicated-from: https://github.com/cloudflare/pingora/pull/308
2024-07-26 13:35:13 -07:00
Wladimir Palant
18db42cd2c Fixes #311 - Make timeouts Sync
Includes-commit: 3faed99e26
Replicated-from: https://github.com/cloudflare/pingora/pull/312
2024-07-26 13:35:13 -07:00
Yuchen Wu
9220e6be2d Fix bleep commit hash 2024-07-26 09:42:33 -07:00
Yuchen Wu
42a847d372 Update 0.3.0 CHANGELOG 2024-07-12 16:55:19 -07:00
Yuchen Wu
9f70abe97b Release 0.3.0 2024-07-12 11:24:29 -07:00
Andrew Hauck
604390cb14 Add support for setting DSCP on client and server sockets 2024-07-12 11:24:29 -07:00
Yuchen Wu
3978afb39f Upgrade to Rust 1.79 2024-07-12 11:24:29 -07:00
Yuchen Wu
aa06317ec7 Correctly cast H2 error for GOAWAY 2024-07-12 11:24:29 -07:00
Yuchen Wu
2ff09e727d Ignore 0.0.0.0 when checking fd mismatch
Avoid false positive since 0.0.0.0 in some systems is mapped
to other IPs.
2024-07-12 11:24:29 -07:00
Yuchen Wu
09b5e03fb1 Provide or_fail() for convenience error conversion. 2024-07-12 11:24:29 -07:00
Yuchen Wu
9a68268da5 Add an example to create and import 3rd party modules 2024-07-12 11:24:29 -07:00
Yuchen Wu
5397e2bd56 Change from debug to display when socket mismatch happens
The display format contains more useful info.
2024-07-12 11:24:29 -07:00
Yuchen Wu
0035064d04 Provide a group key for connection reuse isolation 2024-07-12 11:24:29 -07:00
Yuchen Wu
cdefa5c431 Mark the error source from get_http_session()
Although it is implied that fail_to_connect() errors are already caused
by upstream connections, it is more clear for the user's code inside this callback
by marking the error source in this case.
2024-07-12 11:24:29 -07:00
Yuchen Wu
65b1d6c733 Invoke request_body_filter of modules for proxies 2024-07-12 11:24:29 -07:00
Yuchen Wu
ee7f66082f Allow to create a new connection when the current one is shutting down
When we see a GOAWAY(NO_ERROR), the connector no longer fail the entire request.
Now the connector creates a new connection instead.
2024-07-12 11:24:29 -07:00
Matthew Gumport
38a9d556b5 make seeded estimator and plumbing for tests
I started fidgeting with another one of the tests breaking because of the
estimator not being deterministic, and then decided to do this another way.

This adds `seeded` and `seeded_compact` constructors to the estimator which are
used in tests to override the LFU. These are hidden behind `cfg(test)`. The
`random_status` field of the UFO object is also overridden with the same seeds
as used for the seeded LFU.

These make the tests pass consistently without requiring further monkeying.
2024-06-28 12:34:25 -07:00
Edward Wang
a483902c46 Change max allowed resp headers in HeaderSerde to match H1 max
Currently the allowed max is hardcoded, the HeaderSerde should match the
H1 max count to avoid problems deserializing from cache.
2024-06-28 12:34:25 -07:00
Kevin Guthrie
c67b5d0141 Add a replacement cli-parsing function for Opt that can be used in quickstart with no external dependencies 2024-06-28 12:34:25 -07:00
Wladimir Palant
86e6cd2912 Fixes #261 - Better Default implementation for Opt
---
Empty commit to trigger checks again
---
Another empty commit to trigger checks

Includes-commit: 0e9d853e05
Includes-commit: 1237b26493
Includes-commit: 6fdaf38b63
Replicated-from: https://github.com/cloudflare/pingora/pull/272
2024-06-28 12:34:25 -07:00
Andrew Hauck
ace9d4f135 Update comments on digest functions 2024-06-28 12:34:25 -07:00
Wladimir Palant
23c0378ce6 Fixes #270 - Add Session::digest_mut() method
Includes-commit: 5dd90aadd2
Replicated-from: https://github.com/cloudflare/pingora/pull/271
2024-06-28 12:34:25 -07:00
Yuchen Wu
92bbeb1139 Parse UDS with prefix
Now UDS can be parsed from string with prefix "unix:". The raw path
support will be deprecated.

From https://github.com/cloudflare/pingora/pull/141

Co-authored-by: blackanger <blackanger.z@gmail.com>
2024-06-28 12:34:25 -07:00
Yuchen Wu
62ddb7ebae Move adding ResponseCompression module logic to init_downstream_modules
So that users can override this behavior.
2024-06-28 12:34:25 -07:00
Wladimir Palant
dda7bec58c Added init_downstream_modules phase allowing modules to be set up before startup
Includes-commit: 1bf3d4dfea
Replicated-from: https://github.com/cloudflare/pingora/pull/284
2024-06-28 12:34:25 -07:00
Yuchen Wu
1176af300b Make type alias http::Module public
Easier for 3rd party to implement the trait.
2024-06-28 12:34:25 -07:00
Yuchen Wu
f9148430db Report evction/invalidtion types
This helps the storage to log/track different type of cache deletions.
2024-06-28 12:34:25 -07:00
Edward Wang
03bd29044e Always respect_keepalive when releasing http session
When a user calls `release_http_session` on an http Connector, it is
usually implied that they intend to reuse the underlying connection if
possible. Previously for H1 this involved reaching into the H1 client
Session and calling `respect_keepalive`. The new behavior always
respects keepalive as part of releasing the http session, as it was very
easy to overlook this step and unintentionally disable connection reuse
for H1 sessions.
2024-06-28 12:34:25 -07:00
Andrew Hauck
fbf3a95749 Add a write timeout to write body buf and an option to set a minimum send rate 2024-06-28 12:34:25 -07:00
Edward Wang
6e83d51ab1 Add is_hit fn to RTCache CacheStatus 2024-06-28 12:34:25 -07:00
Yuchen Wu
c0b23c6736 Expose a few more TLS APIs 2024-06-28 12:34:25 -07:00