GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http_server: fix resume after socket close · nodejs/node@d8371a8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _http_server.js
  • test/parallel
    • test-http-regr-gh-2821.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,13 @@ function connectionListener(socket) {
512512
exports._connectionListener = connectionListener;
513513

514514
function onSocketResume() {
515-
this._handle.readStart();
515+
if (this._handle)
516+
this._handle.readStart();
516517
}
517518

518519
function onSocketPause() {
519-
this._handle.readStop();
520+
if (this._handle)
521+
this._handle.readStop();
520522
}
521523

522524
function socketOnWrap(ev, fn) {
@@ -526,7 +528,7 @@ function socketOnWrap(ev, fn) {
526528
return res;
527529
}
528530

529-
if (ev === 'data' || ev === 'readable')
531+
if (this._handle && (ev === 'data' || ev === 'readable'))
530532
this.parser.unconsume(this._handle._externalStream);
531533

532534
return res;
Collapse file

‎test/parallel/test-http-regr-gh-2821.js‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const http = require('http');
5+
6+
const server = http.createServer(function(req, res) {
7+
res.writeHead(200);
8+
res.end();
9+
10+
server.close();
11+
});
12+
13+
server.listen(common.PORT, function() {
14+
15+
const req = http.request({
16+
method: 'POST',
17+
port: common.PORT
18+
});
19+
20+
const payload = new Buffer(16390);
21+
payload.fill('Й');
22+
req.write(payload);
23+
req.end();
24+
});

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.