@@ -39,33 +39,44 @@ public String tryChangeUpHost(String upToken, String lastUsedHost) throws QiniuE
39
39
40
40
private String upHost (String upToken , String lastUsedHost , boolean changeHost , boolean mustReturnUpHost )
41
41
throws QiniuException {
42
- return getScheme ()
43
- + getHelper ().upHost (config .region , upToken , UrlUtils .removeHostScheme (lastUsedHost ), changeHost , mustReturnUpHost );
42
+ String host = getHelper ().upHost (config .region , upToken , UrlUtils .removeHostScheme (lastUsedHost ), changeHost , mustReturnUpHost );
43
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
44
+ return host ;
44
45
}
45
46
46
47
public String ioHost (String ak , String bucket ) throws QiniuException {
47
48
RegionReqInfo regionReqInfo = new RegionReqInfo (ak , bucket );
48
- return getScheme () + config .region .getIovipHost (regionReqInfo );
49
+ String host = config .region .getIovipHost (regionReqInfo );
50
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
51
+ return host ;
49
52
}
50
53
51
54
public String ioSrcHost (String ak , String bucket ) throws QiniuException {
52
55
RegionReqInfo regionReqInfo = new RegionReqInfo (ak , bucket );
53
- return config .region .getIoSrcHost (regionReqInfo );
56
+ String host = config .region .getIoSrcHost (regionReqInfo );
57
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
58
+ return host ;
54
59
}
55
60
56
61
public String apiHost (String ak , String bucket ) throws QiniuException {
57
62
RegionReqInfo regionReqInfo = new RegionReqInfo (ak , bucket );
58
- return getScheme () + config .region .getApiHost (regionReqInfo );
63
+ String host = config .region .getApiHost (regionReqInfo );
64
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
65
+ return host ;
59
66
}
60
67
61
68
public String rsHost (String ak , String bucket ) throws QiniuException {
62
69
RegionReqInfo regionReqInfo = new RegionReqInfo (ak , bucket );
63
- return getScheme () + config .region .getRsHost (regionReqInfo );
70
+ String host = config .region .getRsHost (regionReqInfo );
71
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
72
+ return host ;
64
73
}
65
74
66
75
public String rsfHost (String ak , String bucket ) throws QiniuException {
67
76
RegionReqInfo regionReqInfo = new RegionReqInfo (ak , bucket );
68
- return getScheme () + config .region .getRsfHost (regionReqInfo );
77
+ String host = config .region .getRsfHost (regionReqInfo );
78
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
79
+ return host ;
69
80
}
70
81
71
82
public String rsHost () {
@@ -78,7 +89,8 @@ public String rsHost() {
78
89
if (host == null || host .length () == 0 ) {
79
90
host = Configuration .defaultRsHost ;
80
91
}
81
- return getScheme () + host ;
92
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
93
+ return host ;
82
94
}
83
95
84
96
public String apiHost () {
@@ -91,7 +103,8 @@ public String apiHost() {
91
103
if (host == null || host .length () == 0 ) {
92
104
host = Configuration .defaultApiHost ;
93
105
}
94
- return getScheme () + host ;
106
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
107
+ return host ;
95
108
}
96
109
97
110
public String ucHost () {
@@ -104,7 +117,9 @@ public String ucHost() {
104
117
if (host == null || host .length () == 0 ) {
105
118
host = Configuration .defaultUcHost ;
106
119
}
107
- return getScheme () + host ;
120
+
121
+ host = UrlUtils .setHostScheme (host , config .useHttpsDomains );
122
+ return host ;
108
123
}
109
124
110
125
List <String > ucHostsWithoutScheme () {
@@ -151,10 +166,6 @@ List<String> upHostsWithoutScheme() {
151
166
return new ArrayList <>(hosts );
152
167
}
153
168
154
- private String getScheme () {
155
- return config .useHttpsDomains ? "https://" : "http://" ;
156
- }
157
-
158
169
private void makeSureRegion () {
159
170
if (config .region == null ) {
160
171
if (config .zone != null ) {
0 commit comments