All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
-
curly(andcurly.<method>) is now able to automatically parse the response body based on the content-type header of the response. #240
Default parsers forapplication/json(callsJSON.parse) andtext/*(converts the rawBufferto a string withutf8encoding) were added. This means that for responses without a matching content-type the rawBufferwill be returned. This is different from the previous behavior where a string would always be returned. The default parsers can be overwritten by settingcurly.defaultResponseBodyParsersto an object with the format:{ 'content-type': (data: Buffer, headers: HeaderInfo[]) => any }Where
content-typecan be one of these:- the exact content-type.
- a pattern using
*to match specific parts of the content-type, liketext/*. - a catch-all pattern: just
*.
You can also override the parsers using the following options:
curlyResponseBodyParsersobject that will be merged withdefaultResponseBodyParsers.curlyResponseBodyParsera parser that will be used for all responses.
It's also possible to set
curlyResponseBodyParsertofalseand the data returned will always be the rawBuffer.Of course, it is still possible to use your own
writeFunction(libcurlCURLOPT_WRITEFUNCTIONoption) to set your own write callback and not rely on this default handling of the response.
As curly is marked as experimental, this allows us to do a breaking change in a minor version bump. This release should make the curly API more stable and provide a better developer experience, however, the API remains experimental.
- Some
curly.<method>calls not working correctly, to be more specific, all calls that were notget,postandhead. - Errors thrown by the internal
Curlinstance used bycurlynot being re-thrown correctly. - Progress callbacks were not allowing to use default libcurl progress meter (by returning
CurlProgressFunc.Continue).
- Calling
curly.create(options)will now return a newcurlyobject that will use the passedoptionsas defaults. #247 - TypeScript:
curly(andcurly.<method>) now accepts a generic type parameter which will be the type of thedatareturned. By default, this is set toany. - Added new options to the
curlyAPI:curlyBaseUrl: string, if set, their value will always be added as the prefix for the URL.curlyLowerCaseHeaders: boolean, if set to true, headers will be returned in lower case. Defaults to false. #240
- Added new methods and
CurlFeatureallowing the use of streams to upload and download data without having to setWRITEFUNCTIONand/orREADFUNCTIONmanually. #237Curl.setUploadStreamCurl.setStreamProgressCurl.setStreamResponseHighWaterMarkCurlFeature.StreamResponse
New options were also added to thecurlyAPI:curlyProgressCallbackcurlyStreamResponsecurlyStreamResponseHighWaterMarkcurlyStreamUpload
These new features related to streams are only reliable when using a libcurl version >= 7.69.1.
- Support libcurl info
CURLINFO_CERTINFO. Can be retrieved usinggetInfo("CERTINFO"). Thanks to @Sergey-Mityukov for most of the work on this. - Support libcurl info
CURLINFO_EFFECTIVE_METHOD. Requires libcurl >= 7.72.0. - Support libcurl info
CURLINFO_PROXY_ERROR. UseCurlPxfor constants. Requires libcurl >= 7.73.0. - Support libcurl option
CURLOPT_SSL_EC_CURVES. Requires libcurl >= 7.73.0. - Added prebuilt binaries for Electron v10.1
- The libcurl version being used by prebuilt binaries is now 7.73.0 and it's not built with c-ares.
curlynow has 100% code coverage.
- Removed prebuilt binaries for: Electron v3, Electron v4, Nwjs v0.42, and Nwjs v0.43
2.2.0 - 2020-07-14
- Fix
curly.getnot working correctly (#230) - Fix not resetting
CURLOPT_TRAILERDATAwhen duplicating anEasyinstance (7bf3a51)
- Added initial support to the
CURLMOPT_PUSHFUNCTIONlibcurl multi option. (#232) (b8d0fac) - Added
privatemember to theEasyNativeBindingtypescript class, you can set this value on theEasyinstances to anything, and Typescript should not complain. - Adde prebuilt binaries for Electron v9
- Improved Typescript types / documentation for some libcurl options. (63a71b7)
2.1.3 - 2020-06-02
v2.1.2had a caching issue on during the dist files generation, which caused it to not build some required files.
2.1.2 - 2020-06-01
- Fix
curly.postandcurly.headusing wrong libcurl options to set the HTTP Method. - Fix
postinstallscript not working properly. - Setting the
HTTPPOSToption tonullwould, wrongly, throw an Error. - Setting any string option to
nullwould, wrongly, throw an Error.
- We now have API docs! 🥳 http://jcmais.github.io/node-libcurl/modules/_index_.html Thanks to typedoc
- Added back prebuilt binaries for:
- Electron v3, v4 and v5
- Added
isMonitoringSocketsboolean readonly property toEasyinstances, it istruewhenmonitorSocketEventshas been called on thatEasyinstance. - Added
CurlVersionenum to be used with therawFeaturesproperty returned fromCurl.getVersionInfo.
2.1.1 - 2020-04-28
- Remove
benchmarkfolder from the distributed npm package (reducing the package size)
2.1.0 - 2020-04-12
- Fix retrieve-win-deps Windows build script not working correctly
- Fix context switches between addon callbacks not causing Node.js to drain microtasks - (#177)
- Fix some curl_off_t getinfo values corrupting the stack
WRITEFUNCTION,HEADERFUNCTIONandREADFUNCTIONcallbacks now correctly rethrow JS errors thrown inside of them. The return value of both callbacks is now also checked to be an integer, any other type will cause an error. This is considered a fix because previously the return value was being cast to an integer, which means the method would already fail, as there are remote chances (aka impossible) casting something else to an integer would yield the length of the data passed by libcurl.
- Added missing
CURLOPT_SASL_AUTHZIDoption - libcurl 7.66.0 - Added missing
CURLE_AUTH_ERRORerror code added with libcurl 7.66.0 - Added missing
CURLINFO_RETRY_AFTERinfo field - libcurl 7.66.0 - Added missing
CURL_HTTP_VERSION_3constant related http version to theCurlHttpVersionenum - libcurl 7.66.0 - Added missing
CURLMOPT_MAX_CONCURRENT_STREAMSoption - libcurl 7.67.0 - Added missing
CurlProgressFuncenum to reflect the newCURL_PROGRESSFUNC_CONTINUEconstant - libcurl 7.68.0 - Added missing
CurlSslOptenum memberNoPartialChain- libcurl 7.68.0 - Added missing
CURLE_HTTP3error code - An HTTP/3 layer problem - libcurl 7.68.0 - Added missing
CURLM_WAKEUP_FAILUREerror code - wakeup is unavailable or failed - libcurl 7.68.0 - Added missing
CURLM_BAD_FUNCTION_ARGUMENTerror code - function called with a bad parameter - libcurl 7.69.0 - Added missing
CURLE_QUIC_CONNECT_ERRORerror code - QUIC connection error - libcurl 7.69.0 - Added missing
CURLOPT_MAIL_RCPT_ALLLOWFAILSoption - libcurl 7.69.0
- Prebuilt binaries are now compiled with libcurl 7.69.1 and, when possible, latest version of other related dependencies:
- OpenSSL 1.1.1d
- nghttp2 1.4.0
- libssh2 1.9.0
- Added prebuilt binaries for:
- Electron v8
- NW.js v0.44, v0.43 and v0.42
- Dropped prebuilt binaries for:
- Node.js 8
- Electron v3, v4 and v5
- NW.js v0.38 and v0.39
- Remove dynamic require (#204)
- The C++ implementation for the previously removed
onDataandonHeaderCurl/Easy instance fields has been removed - If you were still using those internal fields your code is going to break. UseWRITEFUNCTIONandHEADERFUNCTIONoptions instead.
2.0.3 - 2019-12-11
- Updated return type of DEBUGFUNCTION (#202)
- Fixed issues when building with newer versions of v8 (Node.js >= 13 and Electron >= 7) (#203)
- Type for
thisadded to event listeners callbacks - Build on Node.js 13 and Electron 7
2.0.2 - 2019-09-20
- Build on Electron v6
- Improved build scripts
- bump libssh2 to 1.9.0
2.0.1 - 2019-06-06
- Fixed problem when building with libcurl <= 7.38
2.0.0 - 2019-06-02
- 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->CurlMultiCode
CURLcode->CurlCode
CURLSHCode->CurlShareCode 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.
- 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
- 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.
- 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.
- Node.js 10 on CI and respective prebuilt binaries
- Removed deprecated NAN method calls
1.3.2 - 2018-05-24
- Curl multi integer options being wrongly tested (#126)
1.3.1 - 2018-05-04
- Changelog file (finally)
- Improved code style, started using prettier