@@ -3,9 +3,9 @@ import { createProxyAgent } from './createProxyAgent';
33import { setServername } from './utils/setServername' ;
44import { parseOptions } from './utils/parseOptions' ;
55
6- // import { debug as nodeDebug } from 'util';
7- //
8- // const debug = nodeDebug('https-proxy');
6+ import { debug as nodeDebug } from 'util' ;
7+
8+ const debug = nodeDebug ( 'https-proxy' ) ;
99
1010export interface HttpsProxyConfig extends tls . ConnectionOptions {
1111 headers ?: { [ key : string ] : string } ;
@@ -38,7 +38,7 @@ export class HttpsProxySocket {
3838 if ( ! options ) {
3939 throw new Error ( 'an HTTP(S) proxy server `host` and `port` must be specified!' ) ;
4040 }
41- console . log ( 'creating new HttpsProxyAgent instance: %o' , sanitizedOptions ) ;
41+ debug ( 'creating new HttpsProxyAgent instance: %o' , sanitizedOptions ) ;
4242
4343 this . proxyConfig = proxyConfig || { } ;
4444 this . proxy = sanitizedOptions as tls . ConnectionOptions ;
@@ -104,11 +104,11 @@ export class HttpsProxySocket {
104104 }
105105
106106 function onclose ( err : any ) {
107- console . log ( 'onclose had error %o' , err ) ;
107+ debug ( 'onclose had error %o' , err ) ;
108108 }
109109
110110 function onend ( ) {
111- console . log ( 'onend' ) ;
111+ debug ( 'onend' ) ;
112112 }
113113
114114 function onerror ( err : any ) {
@@ -129,7 +129,7 @@ export class HttpsProxySocket {
129129
130130 if ( str . indexOf ( END_OF_HEADERS ) < 0 ) {
131131 // keep buffering
132- console . log ( 'have not received end of HTTP headers yet...' ) ;
132+ debug ( 'have not received end of HTTP headers yet...' ) ;
133133 if ( socket . readable ) {
134134 read ( ) ;
135135 } else {
@@ -140,7 +140,7 @@ export class HttpsProxySocket {
140140
141141 const firstLine = str . substring ( 0 , str . indexOf ( '\r\n' ) ) ;
142142 const statusCode = parseInt ( firstLine . split ( ' ' ) [ 1 ] , 10 ) ;
143- console . log ( 'got proxy server response: %o' , firstLine ) ;
143+ debug ( 'got proxy server response: %o' , firstLine ) ;
144144
145145 if ( 200 == statusCode ) {
146146 // 200 Connected status code!
0 commit comments