| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f233b16 commit c0c4de7
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1581,6 +1581,16 @@ added: v0.5.9 | |||
| 1581 | 1581 | Global instance of `Agent` which is used as the default for all HTTP client | |
| 1582 | 1582 | requests. | |
| 1583 | 1583 | ||
| 1584 | + ## http.maxHeaderSize | ||
| 1585 | + <!-- YAML | ||
| 1586 | + added: REPLACEME | ||
| 1587 | + --> | ||
| 1588 | + | ||
| 1589 | + * {number} | ||
| 1590 | + | ||
| 1591 | + Read-only property specifying the maximum allowed size of HTTP headers in bytes. | ||
| 1592 | + Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option. | ||
| 1593 | + | ||
| 1584 | 1594 | ## http.request(options[, callback]) | |
| 1585 | 1595 | <!-- YAML | |
| 1586 | 1596 | added: v0.3.6 | |
@@ -1698,6 +1708,7 @@ There are a few special headers that should be noted. | |||
| 1698 | 1708 | * Sending an Authorization header will override using the `auth` option | |
| 1699 | 1709 | to compute basic authentication. | |
| 1700 | 1710 | ||
| 1711 | + [`--max-http-header-size`]: cli.html#cli_max_http_header_size_size | ||
| 1701 | 1712 | [`'checkContinue'`]: #http_event_checkcontinue | |
| 1702 | 1713 | [`'listening'`]: net.html#net_event_listening | |
| 1703 | 1714 | [`'request'`]: #http_event_request | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,8 @@ const server = require('_http_server'); | |||
| 19 | 19 | exports.ServerResponse = server.ServerResponse; | |
| 20 | 20 | exports.STATUS_CODES = server.STATUS_CODES; | |
| 21 | 21 | ||
| 22 | + let maxHeaderSize; | ||
| 23 | + | ||
| 22 | 24 | ||
| 23 | 25 | const agent = require('_http_agent'); | |
| 24 | 26 | const Agent = exports.Agent = agent.Agent; | |
@@ -92,8 +94,21 @@ Client.prototype.request = function(method, path, headers) { | |||
| 92 | 94 | return c; | |
| 93 | 95 | }; | |
| 94 | 96 | ||
| 97 | + | ||
| 95 | 98 | exports.Client = internalUtil.deprecate(Client, 'http.Client is deprecated.'); | |
| 96 | 99 | ||
| 97 | 100 | exports.createClient = internalUtil.deprecate(function(port, host) { | |
| 98 | 101 | return new Client(port, host); | |
| 99 | 102 | }, 'http.createClient is deprecated. Use http.request instead.'); | |
| 103 | + | ||
| 104 | + Object.defineProperty(module.exports, 'maxHeaderSize', { | ||
| 105 | + configurable: true, | ||
| 106 | + enumerable: true, | ||
| 107 | + get() { | ||
| 108 | + if (maxHeaderSize === undefined) { | ||
| 109 | + maxHeaderSize = process.binding('config').maxHTTPHeaderSize; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + return maxHeaderSize; | ||
| 113 | + } | ||
| 114 | + }); | ||
| 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