rsnext/packages/next/compiled/http-proxy/index.js

1 line
19 KiB
JavaScript
Raw Normal View History

module.exports=(()=>{var e={933:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function Events(){}if(Object.create){Events.prototype=Object.create(null);if(!(new Events).__proto__)r=false}function EE(e,t,r){this.fn=e;this.context=t;this.once=r||false}function addListener(e,t,o,n,s){if(typeof o!=="function"){throw new TypeError("The listener must be a function")}var i=new EE(o,n||e,s),a=r?r+t:t;if(!e._events[a])e._events[a]=i,e._eventsCount++;else if(!e._events[a].fn)e._events[a].push(i);else e._events[a]=[e._events[a],i];return e}function clearEvent(e,t){if(--e._eventsCount===0)e._events=new Events;else delete e._events[t]}function EventEmitter(){this._events=new Events;this._eventsCount=0}EventEmitter.prototype.eventNames=function eventNames(){var e=[],o,n;if(this._eventsCount===0)return e;for(n in o=this._events){if(t.call(o,n))e.push(r?n.slice(1):n)}if(Object.getOwnPropertySymbols){return e.concat(Object.getOwnPropertySymbols(o))}return e};EventEmitter.prototype.listeners=function listeners(e){var t=r?r+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var n=0,s=o.length,i=new Array(s);n<s;n++){i[n]=o[n].fn}return i};EventEmitter.prototype.listenerCount=function listenerCount(e){var t=r?r+e:e,o=this._events[t];if(!o)return 0;if(o.fn)return 1;return o.length};EventEmitter.prototype.emit=function emit(e,t,o,n,s,i){var a=r?r+e:e;if(!this._events[a])return false;var c=this._events[a],f=arguments.length,u,h;if(c.fn){if(c.once)this.removeListener(e,c.fn,undefined,true);switch(f){case 1:return c.fn.call(c.context),true;case 2:return c.fn.call(c.context,t),true;case 3:return c.fn.call(c.context,t,o),true;case 4:return c.fn.call(c.context,t,o,n),true;case 5:return c.fn.call(c.context,t,o,n,s),true;case 6:return c.fn.call(c.context,t,o,n,s,i),true}for(h=1,u=new Array(f-1);h<f;h++){u[h-1]=arguments[h]}c.fn.apply(c.context,u)}else{var p=c.length,d;for(h=0;h<p;h++){if(c[h].once)this.removeListener(e,c[h].fn,undefined,true);switch(f){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,t);break;case 3:c[h].fn.call(c[h].context,t,o);break;case 4:c[h].fn.call(c[h].context,t,o,n);break;default:if(!u)for(d=1,u=new Array(f-1);d<f;d++){u[d-1]=arguments[d]}c[h].fn.apply(c[h].context,u)}}}return true};EventEmitter.prototype.on=function on(e,t,r){return addListener(this,e,t,r,false)};EventEmitter.prototype.once=function once(e,t,r){return addListener(this,e,t,r,true)};EventEmitter.prototype.removeListener=function removeListener(e,t,o,n){var s=r?r+e:e;if(!this._events[s])return this;if(!t){clearEvent(this,s);return this}var i=this._events[s];if(i.fn){if(i.fn===t&&(!n||i.once)&&(!o||i.context===o)){clearEvent(this,s)}}else{for(var a=0,c=[],f=i.length;a<f;a++){if(i[a].fn!==t||n&&!i[a].once||o&&i[a].context!==o){c.push(i[a])}}if(c.length)this._events[s]=c.length===1?c[0]:c;else clearEvent(this,s)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t;if(e){t=r?r+e:e;if(this._events[t])clearEvent(this,t)}else{this._events=new Events;this._eventsCount=0}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.addListener=EventEmitter.prototype.on;EventEmitter.prefixed=r;EventEmitter.EventEmitter=EventEmitter;if(true){e.exports=EventEmitter}},382:(e,t,r)=>{var o=r(835);var n=o.URL;var s=r(605);var i=r(211);var a=r(357);var c=r(413).Writable;var f=r(185)("follow-redirects");var u={GET:true,HEAD:true,OPTIONS:true,TRACE:true};var h=Object.create(null);["abort","aborted","connect","error","socket","timeout"].forEach(function(e){h[e]=function(t,r,o){this._redirectable.emit(e,t,r,o)}});function RedirectableRequest(e,t){c.call(this);this._sanitizeOptions(e);this._options=e;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(t){this.on("response",t)}var r=this;this._onNativeResponse=function(e){r._processResponse(e)};this._performRequest()}RedirectableRequest.prototype=Object.create(c.prototype);RedirectableRequest.prototype.write=function(e,t,r){