File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Version history
22===============
33
4+ ### 3.1.2 (2015-02-17) ###
5+
6+ * Update the example server to have a safe push example.
7+
48### 3.1.1 (2015-01-29) ###
59
610* Bugfix release.
Original file line number Diff line number Diff line change @@ -12,20 +12,20 @@ function onRequest(request, response) {
1212
1313 // Serving server.js from cache. Useful for microbenchmarks.
1414 if ( request . url === cachedUrl ) {
15+ if ( response . push ) {
16+ // Also push down the client js, since it's possible if the requester wants
17+ // one, they want both.
18+ var push = response . push ( '/client.js' ) ;
19+ push . writeHead ( 200 ) ;
20+ fs . createReadStream ( path . join ( __dirname , '/client.js' ) ) . pipe ( push ) ;
21+ }
1522 response . end ( cachedFile ) ;
1623 }
1724
1825 // Reading file from disk if it exists and is safe.
1926 else if ( ( filename . indexOf ( __dirname ) === 0 ) && fs . existsSync ( filename ) && fs . statSync ( filename ) . isFile ( ) ) {
2027 response . writeHead ( '200' ) ;
2128
22- // If they download the certificate, push the private key too, they might need it.
23- if ( response . push && request . url === '/localhost.crt' ) {
24- var push = response . push ( '/localhost.key' ) ;
25- push . writeHead ( 200 ) ;
26- fs . createReadStream ( path . join ( __dirname , '/localhost.key' ) ) . pipe ( push ) ;
27- }
28-
2929 fs . createReadStream ( filename ) . pipe ( response ) ;
3030 }
3131
Original file line number Diff line number Diff line change 11{
22 "name" : " http2" ,
3- "version" : " 3.1.1 " ,
3+ "version" : " 3.1.2 " ,
44 "description" : " An HTTP/2 client and server implementation" ,
55 "main" : " lib/index.js" ,
66 "engines" : {
You can’t perform that action at this time.
0 commit comments