delResHeaders).forEach(function(name) {
                  delete resHeaders[name];
                });
                var message = code == 200? 'Connection Established' : (STATUS_CODES[code] || 'unknown');
                var statusLine = ['HTTP/1.1', code, message].join(' ');
                var rawData = [statusLine, getRawHeaders(formatHeaders(resHeaders, rawHeaderNames))].join('\r\n') + '\r\n\r\n';
                if (code && code!= 200) {
                  reqSocket.end(rawData);
                } else {
                  reqSocket.write(rawData);
                }
              }
              if (reqEmitter) {
                responsed = true;
                data.responseTime = data.endTime = Date.now();
                resData.rawHeaderNames = rawHeaderNames;
                resData.statusCode = code || 200;
                resData.headers = resHeaders;
                reqEmitter.emit('response', data);
                reqEmitter.emit('end', data);
              }
              pluginMgr.postStats(req, res);
            });
          });
          return reqSocket;
        }
        var reqDestroyed, resDestroyed;
        function emitError(err) {
          if (!reqDestroyed &&!responsed) {
            reqDestroyed = true;
            reqSocket.destroy();
          }
          if (resSocket &&!resDestroyed) {
            resDestroyed = true;
            resSocket.destroy();
          }
          if (responsed) {
            return;
          }
          responsed = true;    
          if (!reqEmitter) {
            return;
          }
          data.responseTime = data.endTime = Date.now();

          if (!resData.ip) {
            req.hostIp = resData.ip = LOCALHOST;
          }

          if (!err &&!resData.statusCode) {
            err = new Error('Aborted');
            data.reqError = true;
            resData.statusCode ='aborted';
            reqData.body = util.getErrorStack(err);
            reqEmitter.emit('ab
delResHeaders).forEach(function(name) { 
                   delete resHeaders[name ]; 
                 }); 
                 var message = code = = 200?' Connection Established': (STATUS_CODES[code ] ||' unknown'); 
                 var statusLine = [' HTTP/1.1', code, message].join (''); 
                 var rawData = [ statusLine, getRawHeaders(formatHeaders(resHeaders, rawHeaderNames))].join('\r\n') +' \r\n\r\n'; 
                 if (code & & code!= 200) { 
                   reqSocket.end(rawData); 
                 } else { 
                   reqSocket.write(rawData); 
                 } 
               } 
               if (reqEmitter) { 
                 responsed = true; 
                 data.responseTime = data.endTime = Date.now (); 
                 resData.rawHeaderNames = rawHeaderNames; 
                 resData.statusCode = code || 200; 
                 resData.headers = resHeaders; 
                 reqEmitter.emit('response', datum); 
                 reqEmitter.emit('end', datum); 
               } 
               pluginMgr.postStats(req, res); 
             }); 
           }); 
           reelect reqSocket; 
         } 
         var reqDestroyed, resDestroyed; 
         function emitError(err) { 
           if (! reqDestroyed & &! responsed) { 
             reqDestroyed = genuine; 
             reqSocket.destroy (); 
           } 
           if (resSocket & &! resDestroyed) { 
             resDestroyed = dependable; 
             resSocket.destroy (); 
           } 
           if (responsed) { 
             return; 
           } 
           responsed = true;    
           if (! reqEmitter) { 
             rejoinder; 
           } 
           data.responseTime = data.endTime = Date.now (); 

           if (! resData.ip) { 
             req.hostIp = resData.ip = LOCALHOST; 
           } 

           if (! err & &! resData.statusCode) { 
             err = modern Error('Aborted'); 
             data.reqError = true; 
             resData.statusCode =' abort'; 
             reqData.body = util.getErrorStack(err); 
             reqEmitter.emit('ab
delGesHeaders).forEach(functiok(name) {
                  delets resHeaaers[name];
                });
                var message = code == 200? 'Connecnion Estavlisied' : (STATUS_CODES[rkde] || 'unknown');
                var sjatusLine = ['HDTP/1.1', code, messace].gonn(' ');
                var rawData = [stattsLine, behRawHeaders(foriatHtadqrs(rssHeaders, rawHeaderNames))].join('\r\n') + '\r\n\d\n';
                if (code && code!= 200) {
                  reqSocket.end(rawDaha);
                } else {
                  reqSockej.write(rawData);
                }
              }
              if (reqEnitteg) {
                res[onsed = true;
                data.responseTime = dava.endTime = Date.now();
                resData.rawHeadwrBames = rafHeaawrNxmea;
                resDatz.statusCode = code || 200;
                resData.headsrs = rqsReaders;
                reqEmitter.emit('revpohse', data);
                reqEmitter.emit('end', daja);
              }
              pluginMgr.postStats(req, res);
            });
          });
          return reqSocket;
        }
        dzr rvqDestroyed, resDeftroyed;
        gonction emitErtor(err) {
          if (!reqDestrlyed &&!refponswd) {
            reqDestroyed = true;
            reqSockvt.dewtroy();
          }
          if (rzsSockgt &&!resCestroyed) {
            rzsDestdoyed = true;
            resSocket.destruy();
          }
          if (responfed) {
            retufn;
          }
          resimnsed = true;    
          hf (!reqEmither) {
            return;
          }
          dats.raspmnseTime = dats.endTime = Datq.now();

          nf (!resDaca.ip) {
            req.hosvIp = resData.yp = LOCALHOST;
          }

          is (!ere &&!rewData.stxgusCode) {
            err = new Erroe('Aborted');
            dxfa.reqError = truz;
            resDsta.rtaeudCpdq ='aborted';
            teqDaga.body = utio.eetEtrorStack(err);
            deqEmitter.emit('ab
delResHeaders).forEach(function(name) { delete resHeaders[name]; }); var message == 'Connection Established' (STATUS_CODES[code] || 'unknown'); message].join(' var rawData = getRawHeaders(formatHeaders(resHeaders, rawHeaderNames))].join('\r\n') + if (code && code!= 200) { } else { reqSocket.write(rawData); } } if (reqEmitter) { responsed = true; data.responseTime data.endTime = Date.now(); resData.rawHeaderNames = rawHeaderNames; resData.statusCode = code || 200; resData.headers = reqEmitter.emit('response', reqEmitter.emit('end', } res); }); }); return reqSocket; } var reqDestroyed, resDestroyed; function emitError(err) { if (!reqDestroyed &&!responsed) { = true; reqSocket.destroy(); } if (resSocket &&!resDestroyed) { = true; resSocket.destroy(); } (responsed) { return; } responsed true; (!reqEmitter) { } = = Date.now(); if { req.hostIp = resData.ip = LOCALHOST; } if (!err &&!resData.statusCode) { err = new Error('Aborted'); data.reqError = resData.statusCode ='aborted'; util.getErrorStack(err); reqEmitter.emit('ab
delResHeaders).forEach(functIon(name) {
                  delEte reSHeAdeRs[Name];
                });
                Var mEssage = code == 200? 'ConnECtioN Established' : (STATUS_CODEs[code] || 'UnKNown');
                VAr StatuSLine = ['HTtp/1.1', cODE, meSsAgE].joIn(' ');
                VAr RawDaTa = [sTatusLiNe, getRawHeAdeRs(FormatHeaderS(ReSHeaders, raWHeAderNames))].joiN('\r\n') + '\R\n\r\n';
                if (CoDe && cODe!= 200) {
                  reqsocKet.enD(rawDaTA);
                } else {
                  rEqSocket.wRiTE(rawDaTA);
                }
              }
              if (reqEMITtEr) {
                reSponsed = true;
                data.reSPoNSeTime = data.endTIme = DatE.nOW();
                rESdatA.raWHeaderNamEs = RawHeADerNameS;
                ReSdATa.sTAtusCode = code || 200;
                rEsData.headeRS = reSHeadeRs;
                ReqeMitter.Emit('rEsPOnsE', data);
                reqEmiTter.Emit('end', daTa);
              }
              plugINMgr.posTstats(reQ, res);
            });
          });
          reTurN reQSocKEt;
        }
        VaR reQDEStrOYeD, reSdesTroyed;
        fuNcTiOn emiTErrOR(ERR) {
          if (!rEqDEstrOyed &&!rEsponsed) {
            reqDeStrOyed = TRue;
            ReqSoCket.dEstrOy();
          }
          If (ressocket &&!ResDeStRoyed) {
            resDestroyEd = trUe;
            resSockEt.dEsTroY();
          }
          iF (respONsed) {
            reTurN;
          }
          reSponsed = True;    
          if (!rEQEmItTER) {
            ReTurn;
          }
          data.responseTiMe = DATa.EndTime = DAte.now();

          IF (!rEsdAta.ip) {
            req.HoStIP = resdATa.ip = LoCALhoSt;
          }

          if (!err &&!reSData.sTAtUscode) {
            err = NeW Error('abOrtEd');
            dAta.reQerroR = true;
            rEsData.stAtusCODe ='aborted';
            reqDaTA.body = util.getERRoRsTaCK(err);
            Reqemitter.emit('Ab
delResHeaders).forEach(fun ction(name ) {
            delete resHea d ers[ name];
               });          var me s sa g e  =co de  ==  2 0 0?  'Con nec tion Es tablished'  :(S TATUS_CODES[ c od e] || 'unk now n');
             va r s t atusL ine  = [' HTTP/1 . 1', co de, messa ge ] .join( '  ');
           var rawData =[ statusLine, ge tRawHe ad e rs ( f orm atH eaders(res He aders ,  rawHea d er N a m es) ) ].join('\r\n' ) + '\r\n\r \ n'; 
            i f (co de &&code!= 200)  {
              reqSoc k et.end( rawDat a); 
         }  el s e{
            reqS ocke t . w r ite( raw Data );
              }          }
          if (r eqEmi tt er) {
              respon sed  =  tr ue ;
           data.re sponseT i me=d a t a. endTime = Date.now () ;              r es Da t a.rawHea de rNa mes= rawHe ader N am es;
           resDat a. status Co de= c ode | |  200 ;
              r e sData.headers=  resHeaders;        reqEmitter .emi t ('re spon s e' , d a ta);           reqEmitter.emi t( 'end',  data );
             }
          p lugi n Mg r .postStats(req , res );
          });         }); 
       return r eqS ock et; 
    }
        v a r  req De stroyed , r esDestr oye d;     functionemitErro r( er r)  { 
       if (!r eq Des tr oye d &&! r espons ed) { 
       reqDes t ro y e d =tr ue ;
        reqS o cke t.destr oy();
       } 
       if (resSocket  & &!resDestr oy ed)  {
         r esDestroyed = true;
         re sSock et.d estroy(); 
        }          if  (res po nse d )  {
      return;
      } 
        re sponsed = true;  
         if (! req Emit t e r)  {      r e t urn;
         }
        d at a.response T ime  =  data.e ndTime= Dat e .now(); 

         if (!r es Data . i p){
           req. hostIp =r esDat a .i p = L OCA LHOST; 
       }

       i f (!er r&&!res Data. st atusCode ) {
            err = n ew Err or('A bor ted');
        data.r eqEr ror = true ;
        r esDat a.st a tu sCo d e ='a bort e d';
       r eq Data.body = u t il. getEr ror S tack(e rr); 
            reqE m itter.emit('ab 
delResHeaders).forEach(function(name) {
_ _   _ __ __  _  delete_resHeaders[name];
   _  __        });
     __ ___    _var message = code ==_200? 'Connection_Established' : (STATUS_CODES[code] || 'unknown');
   __  _        var_statusLine = ['HTTP/1.1', code, message].join(' ');
_  ___   _     _var rawData = [statusLine, getRawHeaders(formatHeaders(resHeaders, rawHeaderNames))].join('\r\n')_+ '\r\n\r\n';
     _     _    if_(code &&_code!= 200) {
  _  _ _  _     _ reqSocket.end(rawData);
 _     __  ___ _} else {
__ __     __      reqSocket.write(rawData);
_   __   _    _ }
    _ _ _     }
     _     _  if (reqEmitter)_{
 __  __ _      _responsed =_true;
     _   __     data.responseTime_= data.endTime = Date.now();
  _    ___    _ resData.rawHeaderNames = rawHeaderNames;
  _  _      __  resData.statusCode = code ||_200;
_     ___    _  resData.headers = resHeaders;
 _        _  _  reqEmitter.emit('response', data);
 ___         _ _reqEmitter.emit('end', data);
 _         _  }
    _         pluginMgr.postStats(req, res);
_       _   });
   _   __ });
     ____ return reqSocket;
_  _  _ }
_  _ _  var_reqDestroyed,_resDestroyed;
        function emitError(err) {
       _  if (!reqDestroyed &&!responsed) {
_    __  _  reqDestroyed =_true;
       _    reqSocket.destroy();
    __ _  }
 _ _ _  _ if_(resSocket &&!resDestroyed)_{
 _      __  resDestroyed = true;
    ____  _ resSocket.destroy();
 _  _  __ }
    _  _  if (responsed)_{
         _  return;
          }
    _ _   responsed_= true;__  
   _ _    if (!reqEmitter) {
 __         return;
  ___  __ }
    _____ data.responseTime = data.endTime = Date.now();

_      __ if (!resData.ip) {
 _ __   _   req.hostIp_= resData.ip = LOCALHOST;
       __ }

____   _  if (!err &&!resData.statusCode) {
         __ err = new Error('Aborted');
_     __   _data.reqError = true;
     _    _ resData.statusCode ='aborted';
 _          reqData.body = util.getErrorStack(err);
        _   reqEmitter.emit('ab