File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const common = require ( '../common' ) ;
4+
5+ // Test https://hackerone.com/reports/735748 is fixed.
6+
7+ const assert = require ( 'assert' ) ;
8+ const http = require ( 'http' ) ;
9+ const net = require ( 'net' ) ;
10+
11+ const REQUEST_BB = `POST / HTTP/1.1
12+ Content-Type: text/plain; charset=utf-8
13+ Host: hacker.exploit.com
14+ Connection: keep-alive
15+ Content-Length: 10
16+ Transfer-Encoding: chunked, eee
17+
18+ HELLOWORLDPOST / HTTP/1.1
19+ Content-Type: text/plain; charset=utf-8
20+ Host: hacker.exploit.com
21+ Connection: keep-alive
22+ Content-Length: 28
23+
24+ I AM A SMUGGLED REQUEST!!!
25+ ` ;
26+
27+ const server = http . createServer ( common . mustNotCall ( ) ) ;
28+
29+ server . on ( 'clientError' , common . mustCall ( ( err ) => {
30+ assert . strictEqual ( err . code , 'HPE_UNEXPECTED_CONTENT_LENGTH' ) ;
31+ server . close ( ) ;
32+ } ) ) ;
33+
34+ server . listen ( 0 , common . mustCall ( ( ) => {
35+ const client = net . connect (
36+ server . address ( ) . port ,
37+ common . mustCall ( ( ) => {
38+ client . end ( REQUEST_BB . replace ( / \n / g, '\r\n' ) ) ;
39+ } ) ) ;
40+ } ) ) ;
You can’t perform that action at this time.
0 commit comments