site
Version:
Site Engine is the world's first all-in-one engine to build a modern web site, game, or blog. No HTML or CSS knowledge required.
1 lines • 1.94 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("./shared.manifest");var t=s(require("url")),e=s(require("./shared.main"));function s(t){return t&&t.__esModule?t:{default:t}}var r,h,a=function(t){return null!=t};exports.default=class{constructor(e,s,i,n){((e,s,i,n)=>(()=>{var u,l,o,d,w,c,p,g;this.data=e,this.scheme=s,this.raw=i,this.context=n,this.context.request=this,u=a(this.raw.headers.authorization)?(()=>Buffer.from(this.raw.headers.authorization.split(" ")[1],"base64").toString().split(":"))():void 0,this.authority=this.raw.headers.host,this.authority.startsWith("/")?(()=>{this.host=new h(this.authority),this.port=null})():(()=>-1!==(l=this.authority.search(new RegExp(":[0-9]+$")))?(()=>{this.host=new h(this.authority.substr(0,l)),this.port=this.authority.substr(l)})():(()=>{this.host=new h(this.authority),this.port=null})())(),o=t.default.parse(this.raw.url,!0),this.path=new r(decodeURI(o.pathname)),this.query=[null,""].indexOf(o.search)>=0?null:(()=>o.search.substr(1))(),this.queryObject=o.query,this.method=this.raw.method,this.headers=this.raw.headers,this.credential=a(u)?(()=>({username:u[0],password:u[1]}))():void 0,d=this.headers.range,this.range=a(d)?(()=>(w=d.match(new RegExp("^bytes=(\\d*)-(\\d*)$")),a(w)?(()=>w[1].length>0&&w[2].length>0?(()=>(c=parseInt(w[1]),p=parseInt(w[2]),c<=p?(()=>({start:c,end:p}))():null))():(()=>w[1].length>0&&0===w[2].length?(()=>({start:parseInt(w[1])}))():(()=>0===w[1].length&&w[2].length>0?(()=>(g=parseInt(w[2]))>0?(()=>({suffixByteCount:g}))():null)():null)())())():null))():null})())(e,s,i,n)}},r=e.default.Path,h=class{constructor(t){(t=>(()=>{this.raw=t})())(t)}is(t){return(t=>(()=>t===this.raw)())(t)}in(t){return(t=>(()=>"]"!==this.raw.charAt(this.raw.length-1)&&(()=>-1===this.raw.search(new RegExp("\\.[0-9]+$"))&&(()=>this.raw.endsWith(t)&&(t.length===this.raw.length||"."===this.raw.charAt(this.raw.length-1-t.length)))())())())(t)}};