Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden set_keepalive() to pool only when response read #253

Open
GuyLewin opened this issue Sep 21, 2021 · 0 comments · May be fixed by #255
Open

Harden set_keepalive() to pool only when response read #253

GuyLewin opened this issue Sep 21, 2021 · 0 comments · May be fixed by #255

Comments

@GuyLewin
Copy link
Contributor

Right now httpc:set_keepalive will pool any socket if the HTTP response version + Connection response header support it, even if the body wasn't read yet and the socket isn't ready to be pooled (assuming the body wasn't received by OpenResty yet, because then it will return an error).
I suggest we keep an internal state in httpc to track whether the request and response has completed successfully (probably at the end of the body readers + a few more places) and set_keepalive() will only pool if the socket is ready.
This will prevent pooling sockets in strange states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant