Skip to content

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

Open
@GuyLewin

Description

@GuyLewin
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @GuyLewin

      Issue actions

        Harden set_keepalive() to pool only when response read · Issue #253 · ledgetech/lua-resty-http