ngrok / ngrok-rust

Embed ngrok secure ingress into your Rust apps with a single line of code.
Apache License 2.0
310 stars 18 forks source link

Make sure Ready is returned on proxy_proto remainder polling #116

Closed bobzilladev closed 11 months ago

bobzilladev commented 11 months ago

If an inbound request is too small, no poll_write is issued to the outbound proxy stream by copy_bidirectional, so the data is never written to the inner stream. This adds returns Ready from remainder copying without condition, which resolves issue in an ngrok-python proxy test.

bobzilladev commented 11 months ago

It looks like if there's a remainder in the incoming it is writing to the poll_read buffer, but then delegating the return to the inner.poll_read which is Pending, so copy_bidirectional doesn't copy the remainder over to the outgoing stream. If it always returns Ready after a remainder is copied in, then things work as normal.

bobzilladev commented 11 months ago

the caller will make sure to call your poll method again for you

Looking through copy_bidirectional happened to see that if they get a Pending on write they still try to read some more for a larger write later, was nice to see.