File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,14 @@ http.request = function (params, cb) {
1515 params . host = params . hostname ;
1616 }
1717
18- if ( params . protocol ) {
19- params . scheme = params . protocol . split ( ':' ) [ 0 ] ;
18+ if ( ! params . protocol ) {
19+ if ( params . scheme ) {
20+ params . protocol = params . scheme + ':' ;
21+ } else {
22+ params . protocol = window . location . protocol ;
23+ }
2024 }
2125
22- if ( ! params . scheme ) params . scheme = window . location . protocol . split ( ':' ) [ 0 ] ;
2326 if ( ! params . host ) {
2427 params . host = window . location . hostname || window . location . host ;
2528 }
@@ -29,7 +32,7 @@ http.request = function (params, cb) {
2932 }
3033 params . host = params . host . split ( ':' ) [ 0 ] ;
3134 }
32- if ( ! params . port ) params . port = params . scheme == 'https' ? 443 : 80 ;
35+ if ( ! params . port ) params . port = params . protocol == 'https: ' ? 443 : 80 ;
3336
3437 var req = new Request ( new xhrHttp , params ) ;
3538 if ( cb ) req . on ( 'response' , cb ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ var Request = module.exports = function (xhr, params) {
99 self . xhr = xhr ;
1010 self . body = [ ] ;
1111
12- self . uri = ( params . scheme || 'http' ) + ': //'
12+ self . uri = ( params . protocol || 'http: ' ) + '//'
1313 + params . host
1414 + ( params . port ? ':' + params . port : '' )
1515 + ( params . path || '/' )
You can’t perform that action at this time.
0 commit comments