35. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/24/2017 6:38:26 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

35.1 Files compared

# Location File Last Modified
1 CHAMP_VA1.zip\CHAMP_VA1\node_modules\gulp-nodemon\node_modules\nodemon\node_modules\update-notifier\node_modules\latest-version\node_modules\package-json\node_modules\got\node_modules\infinity-agent http.js Mon Oct 16 21:06:50 2017 UTC
2 CHAMP_VA1.zip\CHAMP_VA1\node_modules\gulp-nodemon\node_modules\nodemon\node_modules\update-notifier\node_modules\latest-version\node_modules\package-json\node_modules\got\node_modules\infinity-agent http.js Mon Oct 23 19:44:48 2017 UTC

35.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 548
Changed 1 2
Inserted 0 0
Removed 0 0

35.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

35.4 Active regular expressions

No regular expressions were active.

35.5 Comparison detail

  1   'use stric t';
  2  
  3   var net =  require('n et');
  4   var util =  require(' util');
  5   var EventE mitter = r equire('ev ents').Eve ntEmitter;
  6  
  7   var debug;
  8  
  9   if (util.d ebuglog) {
  10     debug =  util.debug log('http' );
  11   } else {
  12     debug =  function ( x) {
  13       if (pr ocess.env. NODE_DEBUG  && /http/ .test(proc ess.env.NO DE_DEBUG))  {
  14         cons ole.error( 'HTTP: %s' , x);
  15       }
  16     };
  17   }
  18  
  19   // New Age nt code.
  20  
  21   // The lar gest depar ture from  the previo us impleme ntation is  that
  22   // an Agen t instance  holds con nections f or a varia ble number  of host:p orts.
  23   // Surpris ingly, thi s is still  API compa tible as f ar as thir d parties  are
  24   // concern ed. The on ly code th at really  notices th e differen ce is the
  25   // request  object.
  26  
  27   // Another  departure  is that a ll code re lated to H TTP parsin g is in
  28   // ClientR equest.onS ocket(). T he Agent i s now *str ictly*
  29   // concern ed with ma naging a c onnection  pool.
  30  
  31   function A gent(optio ns) {
  32     if (!(th is instanc eof Agent) )
  33       return  new Agent (options);
  34  
  35     EventEmi tter.call( this);
  36  
  37     var self  = this;
  38  
  39       self.defau ltPort =  PORT ;
  40     self.pro tocol = 'h ttp:';
  41  
  42     self.opt ions = uti l._extend( {}, option s);
  43  
  44     // don't  confuse n et and mak e it think  that we'r e connecti ng to a pi pe
  45     self.opt ions.path  = null;
  46     self.req uests = {} ;
  47     self.soc kets = {};
  48     self.fre eSockets =  {};
  49     self.kee pAliveMsec s = self.o ptions.kee pAliveMsec s || 1000;
  50     self.kee pAlive = s elf.option s.keepAliv e || false ;
  51     self.max Sockets =  self.optio ns.maxSock ets || Age nt.default MaxSockets ;
  52     self.max FreeSocket s = self.o ptions.max FreeSocket s || 256;
  53  
  54     self.on( 'free', fu nction(soc ket, optio ns) {
  55       var na me = self. getName(op tions);
  56       debug( 'agent.on( free)', na me);
  57  
  58       if (!s ocket.dest royed &&
  59           se lf.request s[name] &&  self.requ ests[name] .length) {
  60         self .requests[ name].shif t().onSock et(socket) ;
  61         if ( self.reque sts[name]. length ===  0) {
  62           //  don't lea k
  63           de lete self. requests[n ame];
  64         }
  65       } else  {
  66         // I f there ar e no pendi ng request s, then pu t it in
  67         // t he freeSoc kets pool,  but only  if we're a llowed to  do so.
  68         var  req = sock et._httpMe ssage;
  69         if ( req &&
  70              req.should KeepAlive  &&
  71              !socket.de stroyed &&
  72              self.optio ns.keepAli ve) {
  73           va r freeSock ets = self .freeSocke ts[name];
  74           va r freeLen  = freeSock ets ? free Sockets.le ngth : 0;
  75           va r count =  freeLen;
  76           if  (self.soc kets[name] )
  77              count += s elf.socket s[name].le ngth;
  78  
  79           if  (count >=  self.maxS ockets ||  freeLen >=  self.maxF reeSockets ) {
  80              self.remov eSocket(so cket, opti ons);
  81              socket.des troy();
  82           }  else {
  83              freeSocket s = freeSo ckets || [ ];
  84              self.freeS ockets[nam e] = freeS ockets;
  85              socket.set KeepAlive( true, self .keepAlive Msecs);
  86              socket.unr ef();
  87              socket._ht tpMessage  = null;
  88              self.remov eSocket(so cket, opti ons);
  89              freeSocket s.push(soc ket);
  90           }
  91         } el se {
  92           se lf.removeS ocket(sock et, option s);
  93           so cket.destr oy();
  94         }
  95       }
  96     });
  97   }
  98  
  99   util.inher its(Agent,  EventEmit ter);
  100   exports.Ag ent = Agen t;
  101  
  102   Agent.defa ultMaxSock ets = Infi nity;
  103  
  104   Agent.prot otype.crea teConnecti on = net.c reateConne ction;
  105  
  106   // Get the  key for a  given set  of reques t options
  107   Agent.prot otype.getN ame = func tion(optio ns) {
  108     var name  = '';
  109  
  110     if (opti ons.host)
  111       name + = options. host;
  112     else
  113       name + = 'localho st';
  114  
  115     name +=  ':';
  116     if (opti ons.port)
  117       name + = options. port;
  118     name +=  ':';
  119     if (opti ons.localA ddress)
  120       name + = options. localAddre ss;
  121     name +=  ':';
  122     return n ame;
  123   };
  124  
  125   Agent.prot otype.addR equest = f unction(re q, options ) {
  126     // Legac y API: add Request(re q, host, p ort, path)
  127     if (type of options  === 'stri ng') {
  128       option s = {
  129         host : options,
  130         port : argument s[2],
  131         path : argument s[3]
  132       };
  133     }
  134  
  135     // If we  are not k eepAlive a gent and m axSockets  is Infinit y
  136     // then  disable sh ouldKeepAl ive
  137     if (!thi s.keepAliv e && !Numb er.isFinit e(this.max Sockets))  {
  138       req._l ast = true ;
  139       req.sh ouldKeepAl ive = fals e;
  140     }
  141  
  142     var name  = this.ge tName(opti ons);
  143     if (!thi s.sockets[ name]) {
  144       this.s ockets[nam e] = [];
  145     }
  146  
  147     var free Len = this .freeSocke ts[name] ?  this.free Sockets[na me].length  : 0;
  148     var sock Len = free Len + this .sockets[n ame].lengt h;
  149  
  150     if (free Len) {
  151       // we  have a fre e socket,  so use tha t.
  152       var so cket = thi s.freeSock ets[name]. shift();
  153       debug( 'have free  socket');
  154  
  155       // don 't leak
  156       if (!t his.freeSo ckets[name ].length)
  157         dele te this.fr eeSockets[ name];
  158  
  159       socket .ref();
  160       req.on Socket(soc ket);
  161       this.s ockets[nam e].push(so cket);
  162     } else i f (sockLen  < this.ma xSockets)  {
  163       debug( 'call onSo cket', soc kLen, free Len);
  164       // If  we are und er maxSock ets create  a new one .
  165       req.on Socket(thi s.createSo cket(req,  options));
  166     } else {
  167       debug( 'wait for  socket');
  168       // We  are over l imit so we 'll add it  to the qu eue.
  169       if (!t his.reques ts[name])  {
  170         this .requests[ name] = [] ;
  171       }
  172       this.r equests[na me].push(r eq);
  173     }
  174   };
  175  
  176   Agent.prot otype.crea teSocket =  function( req, optio ns) {
  177     var self  = this;
  178     options  = util._ex tend({}, o ptions);
  179     options  = util._ex tend(optio ns, self.o ptions);
  180  
  181     if (!opt ions.serve rname) {
  182       option s.serverna me = optio ns.host;
  183       if (re q) {
  184         var  hostHeader  = req.get Header('ho st');
  185         if ( hostHeader ) {
  186           op tions.serv ername = h ostHeader. replace(/: .*$/, '');
  187         }
  188       }
  189     }
  190  
  191     var name  = self.ge tName(opti ons);
  192  
  193     debug('c reateConne ction', na me, option s);
  194     options. encoding =  null;
  195     var s =  self.creat eConnectio n(options) ;
  196     if (!sel f.sockets[ name]) {
  197       self.s ockets[nam e] = [];
  198     }
  199     this.soc kets[name] .push(s);
  200     debug('s ockets', n ame, this. sockets[na me].length );
  201  
  202     function  onFree()  {
  203       self.e mit('free' , s, optio ns);
  204     }
  205     s.on('fr ee', onFre e);
  206  
  207     function  onClose(e rr) {
  208       debug( 'CLIENT so cket onClo se');
  209       // Thi s is the o nly place  where sock ets get re moved from  the Agent .
  210       // If  you want t o remove a  socket fr om the poo l, just cl ose it.
  211       // All  socket er rors end i n a close  event anyw ay.
  212       self.r emoveSocke t(s, optio ns);
  213     }
  214     s.on('cl ose', onCl ose);
  215  
  216     function  onRemove( ) {
  217       // We  need this  function f or cases l ike HTTP ' upgrade'
  218       // (de fined by W ebSockets)  where we  need to re move a soc ket from t he
  219       // poo l because  it'll be l ocked up i ndefinitel y
  220       debug( 'CLIENT so cket onRem ove');
  221       self.r emoveSocke t(s, optio ns);
  222       s.remo veListener ('close',  onClose);
  223       s.remo veListener ('free', o nFree);
  224       s.remo veListener ('agentRem ove', onRe move);
  225     }
  226     s.on('ag entRemove' , onRemove );
  227     return s ;
  228   };
  229  
  230   Agent.prot otype.remo veSocket =  function( s, options ) {
  231     var name  = this.ge tName(opti ons);
  232     debug('r emoveSocke t', name,  'destroyed :', s.dest royed);
  233     var sets  = [this.s ockets];
  234  
  235     // If th e socket w as destroy ed, remove  it from t he free bu ffers too.
  236     if (s.de stroyed)
  237       sets.p ush(this.f reeSockets );
  238  
  239     for (var  sk = 0; s k < sets.l ength; sk+ +) {
  240       var so ckets = se ts[sk];
  241  
  242       if (so ckets[name ]) {
  243         var  index = so ckets[name ].indexOf( s);
  244         if ( index !==  -1) {
  245           so ckets[name ].splice(i ndex, 1);
  246           //  Don't lea k
  247           if  (sockets[ name].leng th === 0)
  248              delete soc kets[name] ;
  249         }
  250       }
  251     }
  252  
  253     if (this .requests[ name] && t his.reques ts[name].l ength) {
  254       debug( 'removeSoc ket, have  a request,  make a so cket');
  255       var re q = this.r equests[na me][0];
  256       // If  we have pe nding requ ests and a  socket ge ts closed  make a new  one
  257       this.c reateSocke t(req, opt ions).emit ('free');
  258     }
  259   };
  260  
  261   Agent.prot otype.dest roy = func tion() {
  262     var sets  = [this.f reeSockets , this.soc kets];
  263     for (var  s = 0; s  < sets.len gth; s++)  {
  264       var se t = sets[s ];
  265       var ke ys = Objec t.keys(set );
  266       for (v ar v = 0;  v < keys.l ength; v++ ) {
  267         var  setName =  set[keys[v ]];
  268         for  (var n = 0 ; n < setN ame.length ; n++) {
  269           se tName[n].d estroy();
  270         }
  271       }
  272     }
  273   };
  274  
  275   exports.gl obalAgent  = new Agen t();