http-deceiver is a low-level Node.js module specifically engineered to provide granular control over HTTP stream parsing, allowing developers to process or manipulate raw HTTP request and response data, including potentially malformed or unconventional payloads. This capability makes it suitable for advanced network debugging, security testing (e.g., fuzzing HTTP parsers), or implementing custom proxy solutions where standard HTTP modules might be too restrictive. The package's current stable version is 1.2.7. Given its last update approximately eight years ago (around 2018), it is effectively an abandoned project with no ongoing maintenance or active development. Its event-driven API operates by accepting raw buffer chunks and emitting 'header', 'data', and 'end' events, providing a programmatic interface to dissect and reassemble HTTP message components. Unlike higher-level HTTP client or server libraries, `http-deceiver` directly interacts with the byte stream, offering a unique approach for deep-level HTTP protocol inspection and modification.
npm install http-deceiverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `http-deceiver` to parse a raw HTTP request fed through a `net.Socket`. It sets up a simple `net` server to receive client data, passes that data to `Deceiver`, and listens for `header`, `data`, and `error` events, simulating deep packet inspection or custom HTTP handling.
Consider using actively maintained alternatives for HTTP parsing and manipulation, especially for security-sensitive applications. If direct buffer manipulation is required, assess modern stream parsing libraries or implement custom parsers with robust error handling.
Always use the CommonJS `require` syntax: `const Deceiver = require('http-deceiver');`.Thoroughly test inputs and outputs. Implement robust error handling for the `deceiver.on('error', ...)` event to catch and manage parsing issues gracefully. Refer to its original (limited) documentation or source code for expected buffer formats.Ensure that `Deceiver` is instantiated as a class: `const deceiver = new Deceiver();`.
This package is strictly CommonJS. If you are in an ESM project, you might need a wrapper or dynamic import if your environment supports it, but the primary fix is to ensure the consuming code is CommonJS or use `const Deceiver = require('http-deceiver');` if your setup allows CJS imports in ESM.Carefully examine the raw HTTP buffer being provided. While `http-deceiver` is designed for flexibility, it still expects a certain underlying structure. Debug the raw bytes to ensure they align with the intended (even if malformed) HTTP protocol. Implement comprehensive error handling for the 'error' event emitted by the deceiver.
No dependency data recorded yet.