| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 693e362 commit 446f8b5
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1805,6 +1805,16 @@ added: v0.5.9 | |||
| 1805 | 1805 | Global instance of `Agent` which is used as the default for all HTTP client | |
| 1806 | 1806 | requests. | |
| 1807 | 1807 | ||
| 1808 | + ## http.maxHeaderSize | ||
| 1809 | + <!-- YAML | ||
| 1810 | + added: REPLACEME | ||
| 1811 | + --> | ||
| 1812 | + | ||
| 1813 | + * {number} | ||
| 1814 | + | ||
| 1815 | + Read-only property specifying the maximum allowed size of HTTP headers in bytes. | ||
| 1816 | + Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option. | ||
| 1817 | + | ||
| 1808 | 1818 | ## http.request(options[, callback]) | |
| 1809 | 1819 | <!-- YAML | |
| 1810 | 1820 | added: v0.3.6 | |
@@ -1982,6 +1992,7 @@ will be emitted in the following order: | |||
| 1982 | 1992 | Note that setting the `timeout` option or using the `setTimeout` function will | |
| 1983 | 1993 | not abort the request or do anything besides add a `timeout` event. | |
| 1984 | 1994 | ||
| 1995 | + [`--max-http-header-size`]: cli.html#cli_max_http_header_size_size | ||
| 1985 | 1996 | [`'checkContinue'`]: #http_event_checkcontinue | |
| 1986 | 1997 | [`'request'`]: #http_event_request | |
| 1987 | 1998 | [`'response'`]: #http_event_response | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ const common = require('_http_common'); | |||
| 27 | 27 | const incoming = require('_http_incoming'); | |
| 28 | 28 | const outgoing = require('_http_outgoing'); | |
| 29 | 29 | const server = require('_http_server'); | |
| 30 | + let maxHeaderSize; | ||
| 30 | 31 | ||
| 31 | 32 | const { Server } = server; | |
| 32 | 33 | ||
@@ -59,3 +60,15 @@ module.exports = { | |||
| 59 | 60 | get, | |
| 60 | 61 | request | |
| 61 | 62 | }; | |
| 63 | + | ||
| 64 | + Object.defineProperty(module.exports, 'maxHeaderSize', { | ||
| 65 | + configurable: true, | ||
| 66 | + enumerable: true, | ||
| 67 | + get() { | ||
| 68 | + if (maxHeaderSize === undefined) { | ||
| 69 | + maxHeaderSize = process.binding('config').maxHTTPHeaderSize; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return maxHeaderSize; | ||
| 73 | + } | ||
| 74 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const { spawnSync } = require('child_process'); | ||
| 6 | + const http = require('http'); | ||
| 7 | + | ||
| 8 | + assert.strictEqual(http.maxHeaderSize, 8 * 1024); | ||
| 9 | + const child = spawnSync(process.execPath, ['--max-http-header-size=10', '-p', | ||
| 10 | + 'http.maxHeaderSize']); | ||
| 11 | + assert.strictEqual(+child.stdout.toString().trim(), 10); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments