| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9ac7ac9 commit 9eff92c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -796,6 +796,12 @@ SETTINGS. By default, a maximum number of un-acknowledged `SETTINGS` frame may | |||
| 796 | 796 | be sent at any given time. This error code is used when that limit has been | |
| 797 | 797 | reached. | |
| 798 | 798 | ||
| 799 | + <a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a> | ||
| 800 | + ### ERR_HTTP2_NO_SOCKET_MANIPULATION | ||
| 801 | + | ||
| 802 | + Used when attempting to read, write, pause, and/or resume a socket attached to | ||
| 803 | + an `Http2Session`. | ||
| 804 | + | ||
| 799 | 805 | <a id="ERR_HTTP2_OUT_OF_STREAMS"></a> | |
| 800 | 806 | ### ERR_HTTP2_OUT_OF_STREAMS | |
| 801 | 807 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2046,7 +2046,7 @@ console.log(request.headers); | |||
| 2046 | 2046 | ||
| 2047 | 2047 | See [Headers Object][]. | |
| 2048 | 2048 | ||
| 2049 | - ### request.httpVersion | ||
| 2049 | + #### request.httpVersion | ||
| 2050 | 2050 | <!-- YAML | |
| 2051 | 2051 | added: v8.4.0 | |
| 2052 | 2052 | --> | |
@@ -2117,7 +2117,14 @@ added: v8.4.0 | |||
| 2117 | 2117 | * `msecs` {number} | |
| 2118 | 2118 | * `callback` {Function} | |
| 2119 | 2119 | ||
| 2120 | - Calls `request.connection.setTimeout(msecs, callback)`. | ||
| 2120 | + Sets the [`Http2Stream`]()'s timeout value to `msecs`. If a callback is | ||
| 2121 | + provided, then it is added as a listener on the `'timeout'` event on | ||
| 2122 | + the response object. | ||
| 2123 | + | ||
| 2124 | + If no `'timeout'` listener is added to the request, the response, or | ||
| 2125 | + the server, then [`Http2Stream`]()s are destroyed when they time out. If a | ||
| 2126 | + handler is assigned to the request, the response, or the server's `'timeout'` | ||
| 2127 | + events, timed out sockets must be handled explicitly. | ||
| 2121 | 2128 | ||
| 2122 | 2129 | Returns `request`. | |
| 2123 | 2130 | ||
@@ -2128,13 +2135,24 @@ added: v8.4.0 | |||
| 2128 | 2135 | ||
| 2129 | 2136 | * {net.Socket} | |
| 2130 | 2137 | ||
| 2131 | - The [`net.Socket`][] object associated with the connection. | ||
| 2138 | + Returns a Proxy object that acts as a `net.Socket` but applies getters, | ||
| 2139 | + setters and methods based on HTTP/2 logic. | ||
| 2140 | + | ||
| 2141 | + `destroyed`, `readable`, and `writable` properties will be retrieved from and | ||
| 2142 | + set on `request.stream`. | ||
| 2132 | 2143 | ||
| 2133 | - With TLS support, use [`request.socket.getPeerCertificate()`][] to obtain the | ||
| 2134 | - client's authentication details. | ||
| 2144 | + `destroy`, `emit`, `end`, `on` and `once` methods will be called on | ||
| 2145 | + `request.stream`. | ||
| 2135 | 2146 | ||
| 2136 | - *Note*: do not use this socket object to send or receive any data. All | ||
| 2137 | - data transfers are managed by HTTP/2 and data might be lost. | ||
| 2147 | + `setTimeout` method will be called on `request.stream.session`. | ||
| 2148 | + | ||
| 2149 | + `pause`, `read`, `resume`, and `write` will throw an error with code | ||
| 2150 | + `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See [`Http2Session and Sockets`][] for | ||
| 2151 | + more information. | ||
| 2152 | + | ||
| 2153 | + All other interactions will be routed directly to the socket. With TLS support, | ||
| 2154 | + use [`request.socket.getPeerCertificate()`][] to obtain the client's | ||
| 2155 | + authentication details. | ||
| 2138 | 2156 | ||
| 2139 | 2157 | #### request.stream | |
| 2140 | 2158 | <!-- YAML | |
@@ -2232,15 +2250,15 @@ passed as the second parameter to the [`'request'`][] event. | |||
| 2232 | 2250 | The response implements, but does not inherit from, the [Writable Stream][] | |
| 2233 | 2251 | interface. This is an [`EventEmitter`][] with the following events: | |
| 2234 | 2252 | ||
| 2235 | - ### Event: 'close' | ||
| 2253 | + #### Event: 'close' | ||
| 2236 | 2254 | <!-- YAML | |
| 2237 | 2255 | added: v8.4.0 | |
| 2238 | 2256 | --> | |
| 2239 | 2257 | ||
| 2240 | 2258 | Indicates that the underlying [`Http2Stream`]() was terminated before | |
| 2241 | 2259 | [`response.end()`][] was called or able to flush. | |
| 2242 | 2260 | ||
| 2243 | - ### Event: 'finish' | ||
| 2261 | + #### Event: 'finish' | ||
| 2244 | 2262 | <!-- YAML | |
| 2245 | 2263 | added: v8.4.0 | |
| 2246 | 2264 | --> | |
@@ -2252,7 +2270,7 @@ does not imply that the client has received anything yet. | |||
| 2252 | 2270 | ||
| 2253 | 2271 | After this event, no more events will be emitted on the response object. | |
| 2254 | 2272 | ||
| 2255 | - ### response.addTrailers(headers) | ||
| 2273 | + #### response.addTrailers(headers) | ||
| 2256 | 2274 | <!-- YAML | |
| 2257 | 2275 | added: v8.4.0 | |
| 2258 | 2276 | --> | |
@@ -2265,7 +2283,7 @@ message) to the response. | |||
| 2265 | 2283 | Attempting to set a header field name or value that contains invalid characters | |
| 2266 | 2284 | will result in a [`TypeError`][] being thrown. | |
| 2267 | 2285 | ||
| 2268 | - ### response.connection | ||
| 2286 | + #### response.connection | ||
| 2269 | 2287 | <!-- YAML | |
| 2270 | 2288 | added: v8.4.0 | |
| 2271 | 2289 | --> | |
@@ -2274,7 +2292,7 @@ added: v8.4.0 | |||
| 2274 | 2292 | ||
| 2275 | 2293 | See [`response.socket`][]. | |
| 2276 | 2294 | ||
| 2277 | - ### response.end([data][, encoding][, callback]) | ||
| 2295 | + #### response.end([data][, encoding][, callback]) | ||
| 2278 | 2296 | <!-- YAML | |
| 2279 | 2297 | added: v8.4.0 | |
| 2280 | 2298 | --> | |
@@ -2293,7 +2311,7 @@ If `data` is specified, it is equivalent to calling | |||
| 2293 | 2311 | If `callback` is specified, it will be called when the response stream | |
| 2294 | 2312 | is finished. | |
| 2295 | 2313 | ||
| 2296 | - ### response.finished | ||
| 2314 | + #### response.finished | ||
| 2297 | 2315 | <!-- YAML | |
| 2298 | 2316 | added: v8.4.0 | |
| 2299 | 2317 | --> | |
@@ -2303,7 +2321,7 @@ added: v8.4.0 | |||
| 2303 | 2321 | Boolean value that indicates whether the response has completed. Starts | |
| 2304 | 2322 | as `false`. After [`response.end()`][] executes, the value will be `true`. | |
| 2305 | 2323 | ||
| 2306 | - ### response.getHeader(name) | ||
| 2324 | + #### response.getHeader(name) | ||
| 2307 | 2325 | <!-- YAML | |
| 2308 | 2326 | added: v8.4.0 | |
| 2309 | 2327 | --> | |
@@ -2320,7 +2338,7 @@ Example: | |||
| 2320 | 2338 | const contentType = response.getHeader('content-type'); | |
| 2321 | 2339 | ``` | |
| 2322 | 2340 | ||
| 2323 | - ### response.getHeaderNames() | ||
| 2341 | + #### response.getHeaderNames() | ||
| 2324 | 2342 | <!-- YAML | |
| 2325 | 2343 | added: v8.4.0 | |
| 2326 | 2344 | --> | |
@@ -2340,7 +2358,7 @@ const headerNames = response.getHeaderNames(); | |||
| 2340 | 2358 | // headerNames === ['foo', 'set-cookie'] | |
| 2341 | 2359 | ``` | |
| 2342 | 2360 | ||
| 2343 | - ### response.getHeaders() | ||
| 2361 | + #### response.getHeaders() | ||
| 2344 | 2362 | <!-- YAML | |
| 2345 | 2363 | added: v8.4.0 | |
| 2346 | 2364 | --> | |
@@ -2368,7 +2386,7 @@ const headers = response.getHeaders(); | |||
| 2368 | 2386 | // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } | |
| 2369 | 2387 | ``` | |
| 2370 | 2388 | ||
| 2371 | - ### response.hasHeader(name) | ||
| 2389 | + #### response.hasHeader(name) | ||
| 2372 | 2390 | <!-- YAML | |
| 2373 | 2391 | added: v8.4.0 | |
| 2374 | 2392 | --> | |
@@ -2385,7 +2403,7 @@ Example: | |||
| 2385 | 2403 | const hasContentType = response.hasHeader('content-type'); | |
| 2386 | 2404 | ``` | |
| 2387 | 2405 | ||
| 2388 | - ### response.headersSent | ||
| 2406 | + #### response.headersSent | ||
| 2389 | 2407 | <!-- YAML | |
| 2390 | 2408 | added: v8.4.0 | |
| 2391 | 2409 | --> | |
@@ -2394,7 +2412,7 @@ added: v8.4.0 | |||
| 2394 | 2412 | ||
| 2395 | 2413 | Boolean (read-only). True if headers were sent, false otherwise. | |
| 2396 | 2414 | ||
| 2397 | - ### response.removeHeader(name) | ||
| 2415 | + #### response.removeHeader(name) | ||
| 2398 | 2416 | <!-- YAML | |
| 2399 | 2417 | added: v8.4.0 | |
| 2400 | 2418 | --> | |
@@ -2409,7 +2427,7 @@ Example: | |||
| 2409 | 2427 | response.removeHeader('Content-Encoding'); | |
| 2410 | 2428 | ``` | |
| 2411 | 2429 | ||
| 2412 | - ### response.sendDate | ||
| 2430 | + #### response.sendDate | ||
| 2413 | 2431 | <!-- YAML | |
| 2414 | 2432 | added: v8.4.0 | |
| 2415 | 2433 | --> | |
@@ -2422,7 +2440,7 @@ the response if it is not already present in the headers. Defaults to true. | |||
| 2422 | 2440 | This should only be disabled for testing; HTTP requires the Date header | |
| 2423 | 2441 | in responses. | |
| 2424 | 2442 | ||
| 2425 | - ### response.setHeader(name, value) | ||
| 2443 | + #### response.setHeader(name, value) | ||
| 2426 | 2444 | <!-- YAML | |
| 2427 | 2445 | added: v8.4.0 | |
| 2428 | 2446 | --> | |
@@ -2463,7 +2481,7 @@ const server = http2.createServer((req, res) => { | |||
| 2463 | 2481 | }); | |
| 2464 | 2482 | ``` | |
| 2465 | 2483 | ||
| 2466 | - ### response.setTimeout(msecs[, callback]) | ||
| 2484 | + #### response.setTimeout(msecs[, callback]) | ||
| 2467 | 2485 | <!-- YAML | |
| 2468 | 2486 | added: v8.4.0 | |
| 2469 | 2487 | --> | |
@@ -2482,18 +2500,29 @@ events, timed out sockets must be handled explicitly. | |||
| 2482 | 2500 | ||
| 2483 | 2501 | Returns `response`. | |
| 2484 | 2502 | ||
| 2485 | - ### response.socket | ||
| 2503 | + #### response.socket | ||
| 2486 | 2504 | <!-- YAML | |
| 2487 | 2505 | added: v8.4.0 | |
| 2488 | 2506 | --> | |
| 2489 | 2507 | ||
| 2490 | 2508 | * {net.Socket} | |
| 2491 | 2509 | ||
| 2492 | - Reference to the underlying socket. Usually users will not want to access | ||
| 2493 | - this property. In particular, the socket will not emit `'readable'` events | ||
| 2494 | - because of how the protocol parser attaches to the socket. After | ||
| 2495 | - `response.end()`, the property is nulled. The `socket` may also be accessed | ||
| 2496 | - via `response.connection`. | ||
| 2510 | + Returns a Proxy object that acts as a `net.Socket` but applies getters, | ||
| 2511 | + setters and methods based on HTTP/2 logic. | ||
| 2512 | + | ||
| 2513 | + `destroyed`, `readable`, and `writable` properties will be retrieved from and | ||
| 2514 | + set on `response.stream`. | ||
| 2515 | + | ||
| 2516 | + `destroy`, `emit`, `end`, `on` and `once` methods will be called on | ||
| 2517 | + `response.stream`. | ||
| 2518 | + | ||
| 2519 | + `setTimeout` method will be called on `response.stream.session`. | ||
| 2520 | + | ||
| 2521 | + `pause`, `read`, `resume`, and `write` will throw an error with code | ||
| 2522 | + `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See [`Http2Session and Sockets`][] for | ||
| 2523 | + more information. | ||
| 2524 | + | ||
| 2525 | + All other interactions will be routed directly to the socket. | ||
| 2497 | 2526 | ||
| 2498 | 2527 | Example: | |
| 2499 | 2528 | ||
@@ -2506,7 +2535,7 @@ const server = http2.createServer((req, res) => { | |||
| 2506 | 2535 | }).listen(3000); | |
| 2507 | 2536 | ``` | |
| 2508 | 2537 | ||
| 2509 | - ### response.statusCode | ||
| 2538 | + #### response.statusCode | ||
| 2510 | 2539 | <!-- YAML | |
| 2511 | 2540 | added: v8.4.0 | |
| 2512 | 2541 | --> | |
@@ -2526,7 +2555,7 @@ response.statusCode = 404; | |||
| 2526 | 2555 | After response header was sent to the client, this property indicates the | |
| 2527 | 2556 | status code which was sent out. | |
| 2528 | 2557 | ||
| 2529 | - ### response.statusMessage | ||
| 2558 | + #### response.statusMessage | ||
| 2530 | 2559 | <!-- YAML | |
| 2531 | 2560 | added: v8.4.0 | |
| 2532 | 2561 | --> | |
@@ -2545,7 +2574,7 @@ added: v8.4.0 | |||
| 2545 | 2574 | ||
| 2546 | 2575 | The [`Http2Stream`][] object backing the response. | |
| 2547 | 2576 | ||
| 2548 | - ### response.write(chunk[, encoding][, callback]) | ||
| 2577 | + #### response.write(chunk[, encoding][, callback]) | ||
| 2549 | 2578 | <!-- YAML | |
| 2550 | 2579 | added: v8.4.0 | |
| 2551 | 2580 | --> | |
@@ -2583,7 +2612,7 @@ Returns `true` if the entire data was flushed successfully to the kernel | |||
| 2583 | 2612 | buffer. Returns `false` if all or part of the data was queued in user memory. | |
| 2584 | 2613 | `'drain'` will be emitted when the buffer is free again. | |
| 2585 | 2614 | ||
| 2586 | - ### response.writeContinue() | ||
| 2615 | + #### response.writeContinue() | ||
| 2587 | 2616 | <!-- YAML | |
| 2588 | 2617 | added: v8.4.0 | |
| 2589 | 2618 | --> | |
@@ -2592,7 +2621,7 @@ Sends a status `100 Continue` to the client, indicating that the request body | |||
| 2592 | 2621 | should be sent. See the [`'checkContinue'`][] event on `Http2Server` and | |
| 2593 | 2622 | `Http2SecureServer`. | |
| 2594 | 2623 | ||
| 2595 | - ### response.writeHead(statusCode[, statusMessage][, headers]) | ||
| 2624 | + #### response.writeHead(statusCode[, statusMessage][, headers]) | ||
| 2596 | 2625 | <!-- YAML | |
| 2597 | 2626 | added: v8.4.0 | |
| 2598 | 2627 | --> | |
@@ -2648,7 +2677,7 @@ const server = http2.createServer((req, res) => { | |||
| 2648 | 2677 | Attempting to set a header field name or value that contains invalid characters | |
| 2649 | 2678 | will result in a [`TypeError`][] being thrown. | |
| 2650 | 2679 | ||
| 2651 | - ### response.createPushResponse(headers, callback) | ||
| 2680 | + #### response.createPushResponse(headers, callback) | ||
| 2652 | 2681 | <!-- YAML | |
| 2653 | 2682 | added: v8.4.0 | |
| 2654 | 2683 | --> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments