Using HTTP CONNECT for whois

Support Account
Support Account
  • Updated

To use this method of sending raw data through the proxy for WHOIS protocol you must get approved by your account manager

let auth = 'USER:PASS';
let http = require('http');
let conn = http.request({
    host: 'zproxy.lum-superproxy.io',
    port: 22225,
    method: 'CONNECT',
    path: 'whois.eu:43',
    headers: {
        'Proxy-Authorization': 'Basic '+Buffer.from(auth).toString('base64'),
    }
})
.on('connect', (res, socket, head)=>{
    if (res.statusCode!=200)
        console.error('CONNECT failed:\n'+res.headers);
    res.on('error', e=>console.error('CONNECT error: '+e.message));
    socket.on('error', e=>console.error('socket error: '+e.message));
    socket.on('timeout', e=>console.error('socket timeout: '+e.message));
    socket.on('data', d=>console.log(Buffer.from(d).toString()));
    socket.write('test.eu\r\n', console.error);
})
.on('error', console.error)
.end();
Share this

Was this article helpful?

0 out of 0 found this helpful