File tree 3 files changed +37
-6
lines changed
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;
10
10
const chunkExpression = common . chunkExpression ;
11
11
const debug = common . debug ;
12
12
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;
15
15
const 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;
19
19
20
20
const automaticHeaders = {
21
21
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) {
41
41
// Verify the CONNECT request
42
42
assert . equal ( 'CONNECT localhost:' + common . PORT + ' HTTP/1.1\r\n' +
43
43
'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' ,
45
46
chunk ) ;
46
47
47
48
console . log ( 'PROXY: got CONNECT request' ) ;
You can’t perform that action at this time.
0 commit comments