Added Secured flag for HttpRequest
This commit is contained in:
parent
7ce7dec57c
commit
3ec995e193
@ -37,6 +37,8 @@ class HttpRequest extends EventEmitter
|
|||||||
this.Headers = Headers || {
|
this.Headers = Headers || {
|
||||||
"User-Agent": "BotanSS HttpRequest"
|
"User-Agent": "BotanSS HttpRequest"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.Secured = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetUrl( Url )
|
SetUrl( Url )
|
||||||
@ -52,6 +54,7 @@ class HttpRequest extends EventEmitter
|
|||||||
case "https://":
|
case "https://":
|
||||||
Url = Url.substr( 8 );
|
Url = Url.substr( 8 );
|
||||||
this.Port = 443;
|
this.Port = 443;
|
||||||
|
this.Secured = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ class HttpRequest extends EventEmitter
|
|||||||
{
|
{
|
||||||
if( !this.Hostname ) throw new Error( "Url not set" );
|
if( !this.Hostname ) throw new Error( "Url not set" );
|
||||||
|
|
||||||
var req = ( this.Port == 80 ? http : https )
|
var req = ( this.Secured ? https : http )
|
||||||
.request( this.Options, this.OnResponseReceived.bind( this ) );
|
.request( this.Options, this.OnResponseReceived.bind( this ) );
|
||||||
req.end( this.RawPostData );
|
req.end( this.RawPostData );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user