caddy icon indicating copy to clipboard operation
caddy copied to clipboard

caddyhttp: Export `LengthReader`

Open francislavoie opened this issue 2 years ago • 2 comments

Closes #5728

Exporting it allows other modules to look at the length at any point in time, which may be useful if they hijack the connection.

francislavoie avatar Sep 09 '23 01:09 francislavoie

Exporting this type isn't enough for hijacked connections to see how many bytes are read. As this body is actually http.NoBody for GET request which are usually the hijackable requests.

Also, even if the body is readable (no eof), it has nothing to do with the bytes counting, as the body reads from the connection while Hijack returns the underlying connection.

WeidiDeng avatar Sep 11 '23 02:09 WeidiDeng

/cc @Mygod :point_up:

francislavoie avatar Sep 11 '23 03:09 francislavoie

I'm not sure I can finish this off, I'll leave it to @Mygod who requested it to make the necessary adjustments.

francislavoie avatar Mar 14 '24 21:03 francislavoie