2017-03-06 02:13:09 +00:00
|
|
|
'use strict';
|
|
|
|
|
2017-12-21 02:50:19 +00:00
|
|
|
const { setUnrefTimeout } = require('internal/timers');
|
2016-10-17 18:38:52 +00:00
|
|
|
|
|
|
|
var dateCache;
|
|
|
|
function utcDate() {
|
|
|
|
if (!dateCache) {
|
|
|
|
const d = new Date();
|
|
|
|
dateCache = d.toUTCString();
|
2017-12-21 02:50:19 +00:00
|
|
|
|
|
|
|
setUnrefTimeout(resetCache, 1000 - d.getMilliseconds());
|
2016-10-17 18:38:52 +00:00
|
|
|
}
|
|
|
|
return dateCache;
|
|
|
|
}
|
2017-12-21 02:50:19 +00:00
|
|
|
|
|
|
|
function resetCache() {
|
2016-10-17 18:38:52 +00:00
|
|
|
dateCache = undefined;
|
2017-12-21 02:50:19 +00:00
|
|
|
}
|
2016-10-17 18:38:52 +00:00
|
|
|
|
2017-03-19 19:58:31 +00:00
|
|
|
function ondrain() {
|
|
|
|
if (this._httpMessage) this._httpMessage.emit('drain');
|
|
|
|
}
|
|
|
|
|
2017-03-06 02:13:09 +00:00
|
|
|
module.exports = {
|
2017-03-19 19:58:31 +00:00
|
|
|
outHeadersKey: Symbol('outHeadersKey'),
|
|
|
|
ondrain,
|
2016-10-17 18:38:52 +00:00
|
|
|
utcDate
|
2017-03-06 02:13:09 +00:00
|
|
|
};
|