| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d7eaf3a commit 7322e58
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -280,6 +280,7 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 280 | 280 | ||
| 281 | 281 | int on_headers_complete() { | |
| 282 | 282 | header_nread_ = 0; | |
| 283 | + header_parsing_start_time_ = 0; | ||
| 283 | 284 | ||
| 284 | 285 | // Arguments for the on-headers-complete javascript callback. This | |
| 285 | 286 | // list needs to be kept in sync with the actual argument list for | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,46 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + | ||
| 4 | + const net = require('net'); | ||
| 5 | + const { HTTPParser } = process.binding('http_parser'); | ||
| 6 | + | ||
| 7 | + const server = net.createServer((socket) => { | ||
| 8 | + socket.write('HTTP/1.1 200 OK\r\n'); | ||
| 9 | + socket.write('Transfer-Encoding: chunked\r\n\r\n'); | ||
| 10 | + setTimeout(() => { | ||
| 11 | + socket.write('1\r\n'); | ||
| 12 | + socket.write('\n\r\n'); | ||
| 13 | + setTimeout(() => { | ||
| 14 | + socket.write('1\r\n'); | ||
| 15 | + socket.write('\n\r\n'); | ||
| 16 | + setImmediate(() => { | ||
| 17 | + socket.destroy(); | ||
| 18 | + server.close(); | ||
| 19 | + }); | ||
| 20 | + }, 500); | ||
| 21 | + }, 500); | ||
| 22 | + }).listen(0, () => { | ||
| 23 | + const socket = net.connect(server.address().port); | ||
| 24 | + const parser = new HTTPParser(HTTPParser.RESPONSE, false); | ||
| 25 | + parser.initialize( | ||
| 26 | + HTTPParser.RESPONSE, | ||
| 27 | + {}, | ||
| 28 | + 0, | ||
| 29 | + false, | ||
| 30 | + 1e3 | ||
| 31 | + ); | ||
| 32 | + | ||
| 33 | + parser[HTTPParser.kOnTimeout] = common.mustNotCall(); | ||
| 34 | + | ||
| 35 | + parser[HTTPParser.kOnHeaders] = common.mustNotCall(); | ||
| 36 | + | ||
| 37 | + parser[HTTPParser.kOnExecute] = common.mustCall(3); | ||
| 38 | + | ||
| 39 | + parser[HTTPParser.kOnHeadersComplete] = common.mustCall(); | ||
| 40 | + | ||
| 41 | + parser[HTTPParser.kOnBody] = common.mustCall(2); | ||
| 42 | + | ||
| 43 | + parser[HTTPParser.kOnMessageComplete] = common.mustNotCall(); | ||
| 44 | + | ||
| 45 | + parser.consume(socket._handle); | ||
| 46 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments