Is there a default timeout in Node.js for http.request?

前端 未结 3 1389
后悔当初
后悔当初 2021-02-19 02:08

In Node.js there is a default timeout for a server (for an incoming HTTP request) at 120000ms (2 minutes) (see HTTP\'s server.timeout documentation).

Bu

3条回答
  •  别那么骄傲
    2021-02-19 02:41

    I was also interested in this. By reading the code, Node.js uses Socket under the hood of http request (naturally). (The source link below is referring v8.8.0 at the point when I'm writing this)

    https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js

    And Socket does not have the timeout by default by this document

    https://nodejs.org/dist/latest-v6.x/docs/api/net.html#net_socket_settimeout_timeout_callback

    And the source tells the same.

    https://github.com/nodejs/node/blob/master/lib/net.js

提交回复
热议问题