@@ -201,6 +201,7 @@ function getTunnelConfigForProxiedHttps(agent, reqOptions) {
201201 const result = {
202202 __proto__ : null ,
203203 proxyTunnelPayload : payload ,
204+ maxHeaderSize : reqOptions . maxHeaderSize || getOptionValue ( '--max-http-header-size' ) ,
204205 requestOptions : { // Options used for the request sent after the tunnel is established.
205206 __proto__ : null ,
206207 servername : reqOptions . servername || ipType ? undefined : reqOptions . host ,
@@ -212,9 +213,7 @@ function getTunnelConfigForProxiedHttps(agent, reqOptions) {
212213} ;
213214
214215function establishTunnel ( agent , socket , options , tunnelConfig , afterSocket ) {
215- const { proxyTunnelPayload } = tunnelConfig ;
216- const maxHeaderSize = tunnelConfig . requestOptions . maxHeaderSize ||
217- getOptionValue ( '--max-http-header-size' ) ;
216+ const { proxyTunnelPayload, maxHeaderSize } = tunnelConfig ;
218217 // By default, the socket is in paused mode. Read to look for the 200
219218 // connection established response.
220219 function read ( ) {
@@ -244,7 +243,7 @@ function establishTunnel(agent, socket, options, tunnelConfig, afterSocket) {
244243 // clean up the socket and return an error. Otherwise we establish the tunnel.
245244 let buffer ;
246245 function onProxyData ( chunk ) {
247- debug ( 'onProxyData' , chunk . toString ( ) ) ;
246+ debug ( 'onProxyData' , chunk . length ) ;
248247 buffer = buffer === undefined ? chunk :
249248 Buffer . concat ( [ buffer , chunk ] , buffer . length + chunk . length ) ;
250249 const headerEndIndex = buffer . indexOf ( '\r\n\r\n' ) ;
0 commit comments