File tree Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ const CRLF = common.CRLF;
1010const chunkExpression = common . chunkExpression ;
1111const debug = common . debug ;
1212
13- const connectionExpression = / C o n n e c t i o n / i;
14- const transferEncodingExpression = / T r a n s f e r - E n c o d i n g / i;
13+ const connectionExpression = / ^ C o n n e c t i o n $ / i;
14+ const transferEncodingExpression = / ^ T r a n s f e r - E n c o d i n g $ / i;
1515const closeExpression = / c l o s e / i;
16- const contentLengthExpression = / C o n t e n t - L e n g t h / i;
17- const dateExpression = / D a t e / i;
18- const expectExpression = / E x p e c t / i;
16+ const contentLengthExpression = / ^ C o n t e n t - L e n g t h $ / i;
17+ const dateExpression = / ^ D a t e $ / i;
18+ const expectExpression = / ^ E x p e c t $ / i;
1919
2020const automaticHeaders = {
2121 connection : true ,
Original file line number Diff line number Diff line change 1+ var common = require ( '../common' ) ;
2+ var assert = require ( 'assert' ) ;
3+ var http = require ( 'http' ) ;
4+
5+ var server = http . createServer ( function ( req , res ) {
6+ res . setHeader ( 'X-Date' , 'foo' ) ;
7+ res . setHeader ( 'X-Connection' , 'bar' ) ;
8+ res . setHeader ( 'X-Transfer-Encoding' , 'baz' ) ;
9+ res . end ( ) ;
10+ } ) ;
11+ server . listen ( common . PORT ) ;
12+
13+ server . on ( 'listening' , function ( ) {
14+ var agent = new http . Agent ( { port : common . PORT , maxSockets : 1 } ) ;
15+ http . get ( {
16+ port : common . PORT ,
17+ path : '/hello' ,
18+ agent : agent
19+ } , function ( res ) {
20+ assert . equal ( res . statusCode , 200 ) ;
21+ assert . equal ( res . headers [ 'x-date' ] , 'foo' ) ;
22+ assert . equal ( res . headers [ 'x-connection' ] , 'bar' ) ;
23+ assert . equal ( res . headers [ 'x-transfer-encoding' ] , 'baz' ) ;
24+ assert ( res . headers [ 'date' ] ) ;
25+ assert . equal ( res . headers [ 'connection' ] , 'keep-alive' ) ;
26+ assert . equal ( res . headers [ 'transfer-encoding' ] , 'chunked' ) ;
27+ server . close ( ) ;
28+ agent . destroy ( ) ;
29+ } ) ;
30+ } ) ;
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ var proxy = net.createServer(function(clientSocket) {
4141 // Verify the CONNECT request
4242 assert . equal ( 'CONNECT localhost:' + common . PORT + ' HTTP/1.1\r\n' +
4343 'Proxy-Connections: keep-alive\r\n' +
44- 'Host: localhost:' + proxyPort + '\r\n\r\n' ,
44+ 'Host: localhost:' + proxyPort + '\r\n' +
45+ 'Connection: close\r\n\r\n' ,
4546 chunk ) ;
4647
4748 console . log ( 'PROXY: got CONNECT request' ) ;
You can’t perform that action at this time.
0 commit comments