Notable changes to this project will be documented in this file. This project adheres to Semantic Versioning 2.0.0.
- 不再自动按 HTTP method 名称创建
htp.piping<Method>
和htp.pipingOnly<Method>
方法,但仍支持按htp.piping.<method>
和htp.pipingOnly.<method>
方式引用。
- 取消默认字符集为 utf8 的设置。
- 当内容类型(content-type)未指定字符集时,根据类型数据库提供的默认字符集(如有),尝试将其转换为字符串。
- Support proxy!
- Fixed the bug trying gunzip a HEAD response.
- Response object property
network
added.
- Accept instance of
Array
as BODY.
- An instance of DnsAgent may be passed in via
htp({ dnsAgent })
to create a customised http user agent. - Fixed the bug that dnsAgent and http(s)Agent unnecessarily created when no special settings property passed in.
- Add mothod COPY to the
method-without-payload
list. - Allow all methods to request with payload as long as no arguments omitted. E.g.
// An OVERLOAD2.UnmatchingException will be thrown before. // However, no exception thrown now. htp.delete('http://example.com/source.html', null, { Backup: '/target.html' });
- Fixed the bug that the package depends on itself.
-
Fixed the bug that when
performance
data sometimes incomplete when passed-in agent enableskeepAlive
option:// Event `connect` will be not triggered when `socket` is re-used and already connected. socket.once('connect', function() { timeout.end('CONNECT'); emitOnBodyStream('connect'); timeout.start('RESPONSE', fnDone); timeout.start('DATA', fnDone); Object.assign(connection, object2.clone(socket, [ /^remote/, /^local/ ])); });
-
Fixed the bug that customised settings
keepAlive
not effective. -
Change default settings
keepAlive
totrue
.
- Accept all instance of
stream
rather than only those ofstream.Readable
as body. - Support charset 'ISO-8859-1' on parsing response body.
- Delete items with undefined value from
headers
. Otherwise, an Error will be thrown when http/https try to setHeader with undefined value.
- Catch error on processing response encoded via gzip/deflate.
- Fixed the bug that dependencies missed.
- Default settings changed on
response.timeout
anddata.timeout
.
- Fixed the bug that on response with unsupported charset, an unhandled exception will be thrown.
http.request()
orhttps.request()
is wrapped withtry ... catch ...
.- Standlone instances of
http.Agent
andhttps.Agent
are used in replacement ofhttp.globalAgent
andhttps.globalAgent
. - Default setting
dns_ttl
is changed to 60 (in seconds) from 600000 (in milli-seconds). And the unit of options.dns_ttl is changed to seconds.
- When instance of
stream.Readable
used as HTTP body, errors on the stream will be caught and the request action will be ceased forcely.
- Property
beforeCallback
added tooptions
argument innew SimpleAgent(options)
.
- In this version, hostname in the URL will be replaced with IP address returned by dns-agent before being passed to
http.request()
orhttps.request()
to avoid repetitive DNS requests for resolving the same hostname.
在这个版本中,我们用 dns-agent 返回的 IP 地址替换 URL 中的主机名,然后才将其传递至http.request()
或https.request()
方法。dns-agent 本身具备可靠的及可调节的缓存功能,如果针对同一主机名的 URL 地址,发生高并发调用或短时间内的大量调用,这一作法可以有效避免系统重复发起 DNS 解析。
- Fixed the bug that when invoking methods with payload (e.g. POST and PUT) of instanceof of htp/SimpleAgent, body of falsed value 0-length string will be ignored.
- Force the clientRequest to abort and the incommingMessage (response) to destroy on error ocurring.
此前,当错误发生后,请求和响应可能并未终止,由此可能导致不可预知的问题。
- On piping mode, pass address object to listener of event dns.
- Fixed the bug that, on piping mode, event dns is missed if hostname has been resolved and cached before.
- Fixed the bug that, on piping mode, event error is missed.
- dns-agent is depended while htp is resolving domain names.
- Setting rejectUnauthorized added.
- Byeond basic and piping mode, new pipingOnly mode is offered.
- Returned stream in piping mode will emit events and may be catched via
on(<eventName>, ...)
method. - README in Simplifed Chinese language.
- In previous version,
htp/SimpleAgent
will invokecallback()
(if passed) twice if there is some exception throwed incallback()
itself.
In piping mode, you may get data via piping to a writable stream, or reading response.body
and response.bodyBuffer
directly in function callback(err, response)
which is passed as the last argument.
- In previous versions, htp cannot recognized some key fields in response headers if their names are not lowercased.
Now, htp is streamable. E.g.
htp.piping.get('http://www.example.com/').pipe(fs.createWriteStream('index.html'));
htp/sSimpleAgent added.
Add new action property to Errors throwed. Value of the property is made up of the method name and the url joined with a whitespace, e.g.
htp.get('http://www.example.com/', function(err, response) {
if (err) {
err.action == 'GET http://www.example.com/'; // true
}
});
No promise created or returned when callback() functions offered.
HTTPS requests are supported.
Released.
This CHANGELOG.md follows Keep a CHANGELOG.