v2.0.0
The Release That Took So Long
Breaking Change
- Dropped support for Node.js 4 and 6
- Prebuilt binary is now statically built with brotli, libssh2, nghttp2, OpenSSL and zlib. brotli, OpenSSL, nghttp2 and zlib versions match their respective versions used by Node.js.
- The minimum libcurl version being tested is now
7.50.0, which itself is almost 3 years old.
The addon will still try to be compatible with old versions up to7.32.0, but there are no guarantees. Curl.resetnow correctly resets their instance (#141)- Previously
Curl.codehad all Curl codes into a single enum like object, that is, it included properties for eachCURLMCode,CURLcodeandCURLSHcodelibcurl enums.
Now they are separated, each on their own object:
CURLMCode -> Multi.code
CURLcode->Curl.code
CURLSHCode->Share.code DEBUGFUNCTIONnow receives aBufferas thedataargument, instead of astring.Easy.sendandEasy.recvnow return an object,{ code: CurlCode, bytesSent: number }and{ code: CurlCode, bytesReceived: number }respectively.Curlclass: removed_prefix from their private members.
Only a breaking change in case you were using internal methods.Curlclass: methodsonDataandonHeaderrenamed todefaultWriteFunctionanddefaultHeaderFunction.
Only a breaking change in case you were using internal methods.Curlclass: deprecated instance fieldsonDataandonHeaderwere removed.
Use optionsWRITEFUNCTIONandHEADERFUNCTIONrespectively.Curl.dupHandle, argumentshouldCopyCallbackswas removed, it was the first one.
This is not needed anymore because the previously set callbacks (onDataandonHeader) can now only be set using their respective libcurl options, which is always copied when duplicating a handle.Curl.multimoved toMulti.optionCurl.sharemoved toShare.option- Following members were moved to their own export:
Curl.auth->CurlAuth
Curl.pause->CurlPause
Curl.http->CurlHttpversion
Curl.feature->CurlFeature
Curl.lock->CurlShareLock
Curl.header->CurlHeader
Curl.info.debug->CurlInfoDebug
Curl.netrc->CurlNetrc
Curl.chunk->CurlChunk
Curl.filetype->CurlFileType
Curl.fnmatchfunc->CurlFnMatchFunc
Curl.ftpauth->CurlFtpAuth
Curl.ftpssl->CurlFtpSsl
Curl.ftpmethod->CurlFtpMethod
Curl.rtspreq->CurlRtspRequest
Curl.ipresolve->CurlIpResolve
Curl.proxy->CurlProxy
Curl.pipe->CurlPipe
Curl.usessl->CurlUseSsl
Curl.sslversion->CurlSslVersion
Curl.sslversion.max->CurlSslVersionMax
Curl.ssh_auth->CurlSshAuth
Curl.timecond->CurlTimeCond
Easy.socket->SocketState
And their fields were changed fromSNAKE_CASEtoPascalCase.
The change in casing was to follow Typescript's Enum naming convention. Curl.protocolalso moved to their own exportCurlProtocol, no changes were made to fields casing in this case.- Passing non-integer option value to
Multi.setOptwill now throw an error.
Previously the value was converted to1if it was a truthy value, or0if otherwise.
Fixed
- Fix SigAbort caused by calling v8
AsFunctionon null value atEasy::SetOpt - Fix SegFault during gargage collection after
process.exit(#165) - Using
curl_socket_twithout libcurl version guard onEasy::GetInfo
Added
- Support Node.js 12
- Added missing options:
CURLOPT_DISALLOW_USERNAME_IN_URLCURLOPT_DNS_SHUFFLE_ADDRESSESCURLOPT_DOH_URLCURLOPT_HAPPY_EYEBALLS_TIMEOUT_MSCURLOPT_HAPROXYPROTOCOLCURLOPT_HTTP09_ALLOWEDCURLOPT_REQUEST_TARGETCURLOPT_FTP_FILEMETHOD(#148)CURLOPT_MAXAGE_CONNCURLOPT_PROXY_*CURLOPT_RTSPHEADERCURLOPT_RTSP_REQUESTCURLOPT_SOCKS5_AUTHCURLOPT_SSH_COMPRESSIONCURLOPT_TLS13_CIPHERSCURLOPT_TIMEVALUE_LARGECURLOPT_TRAILERFUNCTIONCURLOPT_UPKEEP_INTERVAL_MS
- Add missing info fields:
CURLINFO_*_{DOWNLOAD,UPLOAD}_TCURLINFO_*_TIME_TCURLINFO_FILETIME_T
- Add
Curl.getVersionInfo()which returns an object that represents the struct returned fromcurl_version_info().
See their type definition for details: [./lib/types/CurlVersionInfoNativeBinding.ts](./lib/types/ - Add
Curl.getVersionInfoString()which returns a string representation of the above function.
It should be almost identical to the one returned fromcurl -V. - Add
Curl.isVersionGreaterOrEqualThan(x, y, z)to help test if the libcurl version the addon was built against is greater or equal than x.y.z. - Add
upkeepfunction to Easy and Curl classes. This is a binding for thecurl_easy_upkeep()function. - Errors thrown inside callbacks are correctly caught / passed forward (if using multi interface)
- All
Curlinstances now set theirUSERAGENTtonode-libcurl/${packageVersion}during creation.
You change the default user agent string by changingCurl.defaultUserAgent, and disable it by setting their value to null. CurlWriteFuncandCurlReadFuncenums with special return codes for their respective options,WRITEFUNCTIONandREADFUNCTION.- Added experimental
curly(url: string, options: {})/curly.<http-verb>(url: string, options: {})async api.
This API can change between minor releases.
Changed
- Migrated project to Typescript and added type definitions
- Bumped libcurl version used on Windows to
7.64.1, which hasnghttp2support - Added the
Curlinstance that emitted the event as the last param passed to events, can be useful if using anonymous functions as callback for the events.
Example:// ... curl.on('end', (statusCode, data, headers, curlInstance) => { // ... })
- Fix erratic condition when setting option
HEADERFUNCTION(#142) - macOS libs should be linked against @rpath (#145)
Special Thanks to @koskokos2 for their contributions to this release.