Commit 8476537
test,http: check that http server is robust from handler abuse
The only way I could find to complete coverage for _http_common.js is to
use semi-private (exposed but probably shouldn't be) handlers to get the
state into something weird. With the if-condition being checked (see
Refs) commented out, I get this result from this test:
```
node:_http_common:140
if (len > 0 && !stream._dumped) {
^
TypeError: Cannot read property '_dumped' of null
at HTTPParser.parserOnBody (node:_http_common:140:26)
```
With the check in place, the test passes without an error. Seems like
quite the edge case, but I'm going to assume it's there for a reason.
Refs: https://coverage.nodejs.org/coverage-b560645d6b0a4bed/lib/_http_common.js.html#L137
PR-URL: #37958
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent b5ad655 commit 8476537
1 file changed
+26
-0
lines changedLines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments