-
-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Describe the bug
Curl.perform() fails with "Received invalid socket from the current connection" after redirects and connection close
This happens after a series of successful HTTP requests with redirects (302 Found). The final response is 200 OK with the header Connection: close, and then the error occurs.
To Reproduce
const { Curl } = require('node-libcurl');
function test() {
const curl = new Curl();
const url = 'https://keycloak.digtlab.ru';
curl.setOpt(Curl.option.VERBOSE, true);
curl.setOpt(Curl.option.SSL_VERIFYHOST, false)
curl.setOpt(Curl.option.SSL_VERIFYPEER, false);
curl.setOpt(Curl.option.FOLLOWLOCATION, true)
curl.setOpt('URL', url);
curl.on('end', function (statusCode, data, headers) {
try {
console.log(statusCode);
} catch (e) {
console.error('Response error:', e);
}
curl.close();
});
curl.on('error', function (err) {
console.error('Curl error:', err);
curl.close();
});
curl.perform();
}
test();
Version information:
Version: v3.0.0-node-v93
OS: Windows 10
Node.js Version: v16.20.2