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 ;
@@ -36,6 +36,7 @@ const nextTick = require('internal/process/next_tick').nextTick;
3636
3737const CRLF = common . CRLF ;
3838const debug = common . debug ;
39+ const utcDate = internalHttp . utcDate ;
3940
4041var RE_FIELDS =
4142 / ^ (?: 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;
@@ -63,24 +64,8 @@ function isCookieField(s) {
6364 return true ;
6465}
6566
66- var dateCache ;
67- function utcDate ( ) {
68- if ( ! dateCache ) {
69- var d = new Date ( ) ;
70- dateCache = d . toUTCString ( ) ;
71- timers . enroll ( utcDate , 1000 - d . getMilliseconds ( ) ) ;
72- timers . _unrefActive ( utcDate ) ;
73- }
74- return dateCache ;
75- }
76- utcDate . _onTimeout = function _onTimeout ( ) {
77- dateCache = undefined ;
78- } ;
79-
80-
8167function noopPendingOutput ( amount ) { }
8268
83-
8469function OutgoingMessage ( ) {
8570 Stream . call ( this ) ;
8671
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