cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.64k stars 1.12k forks source link

feat: expose request length in Session #36

Closed mapleray closed 3 months ago

mapleray commented 5 months ago

for statistic inbound traffic, like $request_length in nginx

drcaramelsyrup commented 3 months ago

Note that we are staging an internal change for body_bytes_read to count request body bytes.

mapleray commented 3 months ago

Note that we are staging an internal change for body_bytes_read to count request body bytes.

Nice!

After a deeper reading of the source code, realized that the code fix wasn't quite right, and that it wasn't quite easy to expose length based on only very small changes to the current code, and will keep following the issue

drcaramelsyrup commented 3 months ago

Forgot to mention that we added body_bytes_read to Session in cfb86c3f16de64d77ac3ecb49ef149d54353f65b. You can also grab the (H1) header byte len via to_h1_raw, if you're interested in that part.