| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -581,11 +581,7 @@ function socketOnTimeout() { | |||
| 581 | 581 | ||
| 582 | 582 | function socketOnClose(socket, state) { | |
| 583 | 583 | debug('server socket close'); | |
| 584 | - // Mark this parser as reusable | ||
| 585 | - if (socket.parser) { | ||
| 586 | - freeParser(socket.parser, null, socket); | ||
| 587 | - } | ||
| 588 | - | ||
| 584 | + freeParser(socket.parser, null, socket); | ||
| 589 | 585 | abortIncoming(state.incoming); | |
| 590 | 586 | } | |
| 591 | 587 | ||
@@ -609,18 +605,15 @@ function socketOnEnd(server, socket, parser, state) { | |||
| 609 | 605 | ||
| 610 | 606 | if (ret instanceof Error) { | |
| 611 | 607 | debug('parse error'); | |
| 608 | + // socketOnError has additional logic and will call socket.destroy(err). | ||
| 612 | 609 | FunctionPrototypeCall(socketOnError, socket, ret); | |
| 613 | - return; | ||
| 614 | - } | ||
| 615 | - | ||
| 616 | - if (!server.httpAllowHalfOpen) { | ||
| 617 | - abortIncoming(state.incoming); | ||
| 618 | - if (socket.writable) socket.end(); | ||
| 610 | + } else if (!server.httpAllowHalfOpen) { | ||
| 611 | + socket.end(); | ||
| 619 | 612 | } else if (state.outgoing.length) { | |
| 620 | 613 | state.outgoing[state.outgoing.length - 1]._last = true; | |
| 621 | 614 | } else if (socket._httpMessage) { | |
| 622 | 615 | socket._httpMessage._last = true; | |
| 623 | - } else if (socket.writable) { | ||
| 616 | + } else { | ||
| 624 | 617 | socket.end(); | |
| 625 | 618 | } | |
| 626 | 619 | } | |
@@ -635,6 +628,7 @@ function socketOnData(server, socket, parser, state, d) { | |||
| 635 | 628 | ||
| 636 | 629 | function onRequestTimeout(socket) { | |
| 637 | 630 | socket[kRequestTimeout] = undefined; | |
| 631 | + // socketOnError has additional logic and will call socket.destroy(err). | ||
| 638 | 632 | ReflectApply(socketOnError, socket, [new ERR_HTTP_REQUEST_TIMEOUT()]); | |
| 639 | 633 | } | |
| 640 | 634 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments