File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed
Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 2323
2424const assert = require ( 'assert' ) . ok ;
2525const Stream = require ( 'stream' ) ;
26- const timers = require ( 'timers' ) ;
2726const util = require ( 'util' ) ;
2827const internalUtil = require ( 'internal/util' ) ;
28+ const internalHttp = require ( 'internal/http' ) ;
2929const Buffer = require ( 'buffer' ) . Buffer ;
3030const common = require ( '_http_common' ) ;
3131const checkIsHttpToken = common . _checkIsHttpToken ;
@@ -37,6 +37,7 @@ const errors = require('internal/errors');
3737
3838const CRLF = common . CRLF ;
3939const debug = common . debug ;
40+ const utcDate = internalHttp . utcDate ;
4041
4142var RE_FIELDS =
4243 / ^ (?: C o n n e c t i o n | T r a n s f e r - E n c o d i n g | C o n t e n t - L e n g t h | D a t e | E x p e c t | T r a i l e r | U p g r a d e ) $ / i;
@@ -64,24 +65,8 @@ function isCookieField(s) {
6465 return true ;
6566}
6667
67- var dateCache ;
68- function utcDate ( ) {
69- if ( ! dateCache ) {
70- var d = new Date ( ) ;
71- dateCache = d . toUTCString ( ) ;
72- timers . enroll ( utcDate , 1000 - d . getMilliseconds ( ) ) ;
73- timers . _unrefActive ( utcDate ) ;
74- }
75- return dateCache ;
76- }
77- utcDate . _onTimeout = function _onTimeout ( ) {
78- dateCache = undefined ;
79- } ;
80-
81-
8268function noopPendingOutput ( amount ) { }
8369
84-
8570function OutgoingMessage ( ) {
8671 Stream . call ( this ) ;
8772
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const timers = require ( 'timers' ) ;
4+
5+ var dateCache ;
6+ function utcDate ( ) {
7+ if ( ! dateCache ) {
8+ const d = new Date ( ) ;
9+ dateCache = d . toUTCString ( ) ;
10+ timers . enroll ( utcDate , 1000 - d . getMilliseconds ( ) ) ;
11+ timers . _unrefActive ( utcDate ) ;
12+ }
13+ return dateCache ;
14+ }
15+ utcDate . _onTimeout = function ( ) {
16+ dateCache = undefined ;
17+ } ;
18+
319function ondrain ( ) {
420 if ( this . _httpMessage ) this . _httpMessage . emit ( 'drain' ) ;
521}
622
723module . exports = {
824 outHeadersKey : Symbol ( 'outHeadersKey' ) ,
925 ondrain,
26+ utcDate
1027} ;
You can’t perform that action at this time.
0 commit comments