File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+ const fixtures = require ( '../common/fixtures' ) ;
4+ if ( ! common . hasCrypto ) {
5+ common . skip ( 'missing crypto' ) ;
6+ }
7+
8+ const http2 = require ( 'http2' ) ;
9+ const key = fixtures . readKey ( 'agent1-key.pem' , 'binary' ) ;
10+ const cert = fixtures . readKey ( 'agent1-cert.pem' , 'binary' ) ;
11+
12+ const server = http2 . createSecureServer ( { key, cert } ) ;
13+
14+ let client_stream ;
15+
16+ server . on ( 'stream' , common . mustCall ( function ( stream ) {
17+ stream . resume ( ) ;
18+ stream . on ( 'data' , function ( chunk ) {
19+ stream . write ( chunk ) ;
20+ client_stream . pause ( ) ;
21+ client_stream . close ( http2 . constants . NGHTTP2_CANCEL ) ;
22+ } ) ;
23+ } ) ) ;
24+
25+ server . listen ( 0 , function ( ) {
26+ const client = http2 . connect ( `https://localhost:${ server . address ( ) . port } ` ,
27+ { rejectUnauthorized : false }
28+ ) ;
29+ client_stream = client . request ( { ':method' : 'POST' } ) ;
30+ client_stream . on ( 'close' , common . mustCall ( ( ) => {
31+ client . close ( ) ;
32+ server . close ( ) ;
33+ } ) ) ;
34+ client_stream . resume ( ) ;
35+ client_stream . write ( Buffer . alloc ( 1024 * 1024 ) ) ;
36+ } ) ;
You can’t perform that action at this time.
0 commit comments