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

fix: Re-add support for clientError listeners #1897

Merged
merged 2 commits into from Mar 24, 2022

Commits on Mar 23, 2022

  1. fix: Re-add support for clientError listeners

    In the recent fix #1895, the `clientError` event was removed from the
    list of events proxied from the underlying server object to the restify
    Server. That fix was needed because merely adding a listener to the
    underlying server for the `clientError` event prevents the default
    behavior of returning an appropriate error code and closing the socket.
    So by setting up a listener to proxy the event we were preventing that
    default behavior, leading to hanging/leaked requests.
    
    But! We should still support proxying `clientError` events if restify
    users have added a listener for it. This enables logging or other custom
    behavior. Restify users adding a `clientError` listener take on the
    responsibility of sending an appropriate error and closing the socket,
    exactly as noted in the Node.js docs for the `clientError` event.
    https://nodejs.org/docs/latest-v16.x/api/http.html#event-clienterror
    
    This change ensures we add a listener for `clientError` to the
    underlying server object if and only if a listener for `clientError` has
    been added to the restify server.
    josephharrington committed Mar 23, 2022
    Copy the full SHA
    d5447f4 View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2022

  1. Copy the full SHA
    26af1a3 View commit details
    Browse the repository at this point in the history