File tree 2 files changed +19
-17
lines changed
2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 23
23
24
24
const assert = require ( 'assert' ) . ok ;
25
25
const Stream = require ( 'stream' ) ;
26
- const timers = require ( 'timers' ) ;
27
26
const util = require ( 'util' ) ;
28
27
const internalUtil = require ( 'internal/util' ) ;
28
+ const internalHttp = require ( 'internal/http' ) ;
29
29
const Buffer = require ( 'buffer' ) . Buffer ;
30
30
const common = require ( '_http_common' ) ;
31
31
const checkIsHttpToken = common . _checkIsHttpToken ;
@@ -36,6 +36,7 @@ const nextTick = require('internal/process/next_tick').nextTick;
36
36
37
37
const CRLF = common . CRLF ;
38
38
const debug = common . debug ;
39
+ const utcDate = internalHttp . utcDate ;
39
40
40
41
var RE_FIELDS =
41
42
/ ^ (?: 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) {
63
64
return true ;
64
65
}
65
66
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
-
81
67
function noopPendingOutput ( amount ) { }
82
68
83
-
84
69
function OutgoingMessage ( ) {
85
70
Stream . call ( this ) ;
86
71
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
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
+
3
19
function ondrain ( ) {
4
20
if ( this . _httpMessage ) this . _httpMessage . emit ( 'drain' ) ;
5
21
}
6
22
7
23
module . exports = {
8
24
outHeadersKey : Symbol ( 'outHeadersKey' ) ,
9
25
ondrain,
26
+ utcDate
10
27
} ;
You can’t perform that action at this time.
0 commit comments