File tree Expand file tree Collapse file tree 3 files changed +332
-300
lines changed
Expand file tree Collapse file tree 3 files changed +332
-300
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable global-require */
12'use strict' ;
23
4+ /*
5+ * FIXME: Restify depends on `spdy`, which in turn depends on `http-deceiver`,
6+ * which uses the legacy C library `http_parser`.
7+ *
8+ * Newer versions of Node.js have removed `http_parser` in favor of
9+ * modern APIs. Unfortunately:
10+ * - `http-deceiver` was last updated ~9 years ago,
11+ * - `spdy` ~5 years ago,
12+ * - Restify itself ~2 years ago.
13+ *
14+ * As a result, these outdated libraries haven’t been replaced.
15+ *
16+ * Quick fix: polyfill `http_parser`.
17+ * Possible Long-term fix: fork Restify and remove/replace the outdated deps.
18+ */
19+ const originalBinding = process . binding ;
20+ process . binding = function ( name ) {
21+ if ( name === 'http_parser' ) {
22+ return require ( 'http-parser-js' ) ;
23+ }
24+ return originalBinding . call ( process , name ) ;
25+ } ;
26+
327// Main application file
428// Run as 'node app.js' to start
529const path = require ( 'path' ) ;
You can’t perform that action at this time.
0 commit comments