File tree 2 files changed +8
-5
lines changed
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) {
15
15
params . host = params . hostname ;
16
16
}
17
17
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
+ }
20
24
}
21
25
22
- if ( ! params . scheme ) params . scheme = window . location . protocol . split ( ':' ) [ 0 ] ;
23
26
if ( ! params . host ) {
24
27
params . host = window . location . hostname || window . location . host ;
25
28
}
@@ -29,7 +32,7 @@ http.request = function (params, cb) {
29
32
}
30
33
params . host = params . host . split ( ':' ) [ 0 ] ;
31
34
}
32
- if ( ! params . port ) params . port = params . scheme == 'https' ? 443 : 80 ;
35
+ if ( ! params . port ) params . port = params . protocol == 'https: ' ? 443 : 80 ;
33
36
34
37
var req = new Request ( new xhrHttp , params ) ;
35
38
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) {
9
9
self . xhr = xhr ;
10
10
self . body = [ ] ;
11
11
12
- self . uri = ( params . scheme || 'http' ) + ': //'
12
+ self . uri = ( params . protocol || 'http: ' ) + '//'
13
13
+ params . host
14
14
+ ( params . port ? ':' + params . port : '' )
15
15
+ ( params . path || '/' )
You can’t perform that action at this time.
0 commit comments