| 141 | } |
| 142 | |
| 143 | function parserOnMessageComplete() { |
| 144 | const parser = this; |
| 145 | const stream = parser.incoming; |
| 146 | |
| 147 | if (stream !== null && !stream[kSkipPendingData]) { |
| 148 | stream.complete = true; |
| 149 | // Emit any trailing headers. |
| 150 | const headers = parser._headers; |
| 151 | if (headers.length) { |
| 152 | stream._addHeaderLines(headers, headers.length); |
| 153 | parser._headers = []; |
| 154 | parser._url = ''; |
| 155 | } |
| 156 | |
| 157 | // For emit end event |
| 158 | stream.push(null); |
| 159 | } |
| 160 | |
| 161 | // Force to read the next incoming message |
| 162 | readStart(parser.socket); |
| 163 | } |
| 164 | |
| 165 | |
| 166 | const parsers = new FreeList('parsers', 1000, function parsersCb() { |