GithubHelp home page GithubHelp logo

Comments (11)

mcollina avatar mcollina commented on June 10, 2024

@ronag this is where it is handled: https://github.com/pinojs/pino-http/blob/master/logger.js#L49-L53.

What do you propose? Would you like to send a PR?

from pino-http.

ronag avatar ronag commented on June 10, 2024

I don't think there is a way in NodeJS to differentiate between client and server aborted. When the client aborts, printing an error with 418 is confusing.

from pino-http.

mcollina avatar mcollina commented on June 10, 2024

I don't think there is a way in NodeJS to differentiate between client and server aborted. When the client aborts, printing an error with 418 is confusing.

What do you mean?

from pino-http.

ronag avatar ronag commented on June 10, 2024

@mcollina: There are two scenarios where an "aborted" event is emitted.

  1. Server aborts due to server.timeout or req.socket.setTimeout. The current behaviour is correct for this case.
  2. The client chooses to abort the request. The current behaviour is confusing for this case. It's not a timeout (408) and it's not an error for GET and HEAD requests.

from pino-http.

davidmarkclements avatar davidmarkclements commented on June 10, 2024

Perhaps we can listen for a close event for detecting client abort...

Perhaps also veryifing by listening for a timeout on the server object for server side timeouts

from pino-http.

davidmarkclements avatar davidmarkclements commented on June 10, 2024

although we're going to want to handle this in the most performant way of course..

@ronag can you point to a spec doc detailing a 408 not being an error for GET and HEAD ?

from pino-http.

ronag avatar ronag commented on June 10, 2024

@davidmarkclements: A client aborting GET or HEAD is not a server error since they should be side effect free. (9.1.1 Safe Methods). Server aborting due to timeout should still be 408.

from pino-http.

ronag avatar ronag commented on June 10, 2024
  1. regardless of the method, a client aborting is not a timeout.
  2. a client aborting a safe method is not a server error.

from pino-http.

mcollina avatar mcollina commented on June 10, 2024

@ronag I still do not know yet how to fix this, and what do you propose. Also, #21 was closed.
Would you like to submit a PR with unit tests? You investigated this issue with much more details than us.

from pino-http.

ronag avatar ronag commented on June 10, 2024

@mcollina I don't know yet. nodejs/node#11014

from pino-http.

ronag avatar ronag commented on June 10, 2024

@mcollina #22

from pino-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.