@@ -23,12 +23,13 @@ web_o = Object.keys(web_o).map(function(pass) {
23
23
*
24
24
* @param {ClientRequest } Req Request object
25
25
* @param {IncomingMessage} Res Response object
26
- * @param {Object } Options Config object passed to the proxy
27
26
*
28
27
* @api private
29
28
*/
30
29
31
- function deleteLength ( req , res , options ) {
30
+ function deleteLength ( req , res ) {
31
+ // Now the options are stored on this
32
+ var options = this . options ;
32
33
if ( req . method === 'DELETE' && ! req . headers [ 'content-length' ] ) {
33
34
req . headers [ 'content-length' ] = '0' ;
34
35
}
@@ -39,12 +40,13 @@ web_o = Object.keys(web_o).map(function(pass) {
39
40
*
40
41
* @param {ClientRequest } Req Request object
41
42
* @param {IncomingMessage} Res Response object
42
- * @param {Object } Options Config object passed to the proxy
43
43
*
44
44
* @api private
45
45
*/
46
46
47
- function timeout ( req , res , options ) {
47
+ function timeout ( req , res ) {
48
+ // Now the options are stored on this
49
+ var options = this . options ;
48
50
if ( options . timeout ) {
49
51
req . socket . setTimeout ( options . timeout ) ;
50
52
}
@@ -55,12 +57,13 @@ web_o = Object.keys(web_o).map(function(pass) {
55
57
*
56
58
* @param {ClientRequest } Req Request object
57
59
* @param {IncomingMessage} Res Response object
58
- * @param {Object } Options Config object passed to the proxy
59
60
*
60
61
* @api private
61
62
*/
62
63
63
- function XHeaders ( req , res , options ) {
64
+ function XHeaders ( req , res ) {
65
+ // Now the options are stored on this
66
+ var options = this . options ;
64
67
if ( ! options . xfwd ) return ;
65
68
66
69
var values = {
@@ -84,24 +87,26 @@ web_o = Object.keys(web_o).map(function(pass) {
84
87
*
85
88
* @param {ClientRequest } Req Request object
86
89
* @param {IncomingMessage} Res Response object
87
- * @param {Object } Options Config object passed to the proxy
88
90
*
89
91
* @api private
90
92
*/
91
93
92
- function stream ( req , res , server , _ , clb ) {
93
- if ( server . options . forward ) {
94
+ function stream ( req , res , head , clb ) {
95
+ var server = this ;
96
+ // Now the options are stored on this
97
+ var options = this . options ;
98
+ if ( options . forward ) {
94
99
// If forward enable, so just pipe the request
95
- var forwardReq = ( server . options . forward . protocol === 'https:' ? https : http ) . request (
96
- common . setupOutgoing ( server . options . ssl || { } , server . options , req , 'forward' )
100
+ var forwardReq = ( options . forward . protocol === 'https:' ? https : http ) . request (
101
+ common . setupOutgoing ( options . ssl || { } , options , req , 'forward' )
97
102
) ;
98
103
req . pipe ( forwardReq ) ;
99
104
return res . end ( ) ;
100
105
}
101
106
102
107
// Request initalization
103
- var proxyReq = ( server . options . target . protocol === 'https:' ? https : http ) . request (
104
- common . setupOutgoing ( server . options . ssl || { } , server . options , req )
108
+ var proxyReq = ( options . target . protocol === 'https:' ? https : http ) . request (
109
+ common . setupOutgoing ( options . ssl || { } , options , req )
105
110
) ;
106
111
107
112
// Error Handler
0 commit comments