Commit graph

84 commits

Author SHA1 Message Date
Yuchen Wu
7507b69683 Fix clipper warning on Rust 1.78 2024-05-10 15:22:37 -07:00
Kevin Guthrie
1a6af266a0 cargo fmt 2024-05-10 15:22:37 -07:00
James Munns
880488987c Add Service<HttpProxy<T>> constructor for providing name
Includes-commit: 8727b2466f
Replicated-from: https://github.com/cloudflare/pingora/pull/218
2024-05-10 15:22:37 -07:00
Andrew Hauck
2625a1b42e Add upstream_response_trailer_filter reference to user guide 2024-05-10 15:22:37 -07:00
ewang
cfb89c6eb5 Add purge_response callback
Allow generating custom responses to purge requests (requests to
invalidate or delete from the HTTP cache).
2024-05-10 15:22:37 -07:00
Benjamin Leggett
b493ac0c95 Make pop_closed pub, to simplify DIY drains
Includes-commit: 069a792c91
Replicated-from: https://github.com/cloudflare/pingora/pull/209
Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>
2024-05-10 15:22:37 -07:00
Andrew Hauck
6229cc555c Always return HttpTask::Body on body done instead of HttpTask::done 2024-05-10 15:22:37 -07:00
Yuchen Wu
1b7d43207b parse and send HTTP/1 reason phrase
This change allows customized HTTP1 reason phrase to be used and
proxied.
2024-05-10 15:22:37 -07:00
Alex Severin
4347ef4471 finish zip todo
Includes-commit: 68a9196642
Replicated-from: https://github.com/cloudflare/pingora/pull/214
2024-05-10 15:22:37 -07:00
Alex Severin
2a449ac305 unzip map items
Includes-commit: db64afd0a3
Replicated-from: https://github.com/cloudflare/pingora/pull/216
2024-05-10 15:22:37 -07:00
yaohuiming
42b0224129 Add async_cleanup() method to ServerApp trait
---
Refactor cleanup functions to use async/await

Includes-commit: 3cd52fee46
Includes-commit: 58946a8d58
Replicated-from: https://github.com/cloudflare/pingora/pull/193
2024-05-10 15:22:37 -07:00
Andrew Hauck
2501d4adb0 Fix non linux build 2024-04-26 12:31:57 -04:00
Johan Planchon
218dbdfd5d Update zstd-safe to 7.1.0 and zstd to 0.13.1 in pingora-header-serde
Includes-commit: 0026a572a7
Replicated-from: https://github.com/cloudflare/pingora/pull/197
2024-04-26 12:31:57 -04:00
Kevin Guthrie
e19d8c817d Splitting out the daemon group_id type for MacOs and FreeBsd 2024-04-26 12:31:57 -04:00
Yonas
5fde29f6fc Fix build on FreeBSD.
Define `group_id` in the pingora-core's server daemon on FreeBSD.
---
Merge branch 'cloudflare:main' into yonas-~~~

Co-authored-by: Yonas Yanfa <yonas.y@gmail.com>
Includes-commit: 30ee1e8bd4
Includes-commit: df9f2da7bd
Replicated-from: https://github.com/cloudflare/pingora/pull/28
2024-04-26 12:31:57 -04:00
Andrew Hauck
a6bd816f16 Add support for downstream h2 trailers and add an upstream h2 response trailer filter 2024-04-26 12:31:57 -04:00
Yuchen Wu
93ad08ea3e Add the ability to set TCP recv buf size 2024-04-26 12:31:57 -04:00
Shane Utt
586781a685 docs: add build requirements to README.md
Includes-commit: ba75f36b39
Replicated-from: https://github.com/cloudflare/pingora/pull/7
2024-04-26 12:31:57 -04:00
Gustav Davidsson
2631da74b0 Vary examples 2024-04-26 12:31:57 -04:00
ewang
7b838b8118 Add a convenience function to retrieve Session digest 2024-04-22 08:48:19 -07:00
ewang
cfb86c3f16 Add body_bytes_read() method to Session
Add an API to retrieve request body bytes read so far.
2024-04-22 08:48:19 -07:00
Matthew Gumport
01c69659c8 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:48:19 -07:00
Xiaobo Liu
99cb79bf2b 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:48:19 -07:00
Matthew Gumport
3675d35f1c 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:48:19 -07:00
Matthew Gumport
a8b6bbe9f4 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:48:19 -07:00
Kevin Guthrie
a23d4d8ef1 Fix #186 Expose Bucket to prevent compile error in Rust <= 1.73 2024-04-22 08:48:19 -07:00
Yesterday17
6e6b4f6705 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:48:19 -07:00
JiajunDu
3dbab9ea78 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:48:19 -07:00
gengteng
a680ccee41 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:48:19 -07:00
atamakahere
bd6ca1094c 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:48:19 -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