Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
// apt-get install libcurl4-openssl-dev
// IF YOU USE 32-BIT NODEJS:
// patch /usr/include/curl/curlbuild.h
// #define CURL_SIZEOF_LONG 4
// #define CURL_SIZEOF_CURL_OFF_T 4
var Curl = require('node-libcurl').Curl;
var curl = new Curl();
curl.setOpt('URL', 'www.yandex.ru');
curl.setOpt('FOLLOWLOCATION', true);
curl.on('end', function (status) {
if (status === 200) {
console.log('ok');
}
this.close(); // eslint-disable-line no-invalid-this
});
curl.perform();
return new Promise((resolve, reject) => {
const curl = new Curl();
const postData = createUploadPostData(mutation, filePaths, mapVariables);
const processedPostData = [
{
name: 'operations',
contents: JSON.stringify(postData.operations),
},
{
name: 'map',
contents:
'{' +
Object.entries(postData.map)
.map(([i, path]) => `"${i}":["${path}"]`)
.join(',') +
'}',
},
T.async(done => {
const req = new C.Curl();
const reqHead = [
...(isJson(requestType)
? ["Content-Type: application/json"]
: []),
...pipe(
headers,
R.collect((k, v) => `${k}: ${v}`)
)
];
req.setOpt("URL", url);
req.setOpt("CAINFO", caPath);
req.setOpt("FOLLOWLOCATION", 1);
req.setOpt("VERBOSE", 0);
req.setOpt("SSL_VERIFYHOST", 2);
req.setOpt("SSL_VERIFYPEER", 1);
this._reset = () => {
this.curl = new Curl();
};