Skip to content

Commit e7cf205

Browse files
committed
add user agent in HEAD request as well
1 parent 6fd80d6 commit e7cf205

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

core/src/main/java/com/cloud/storage/template/SimpleHttpMultiFileDownloader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ private void tryAndGetTotalRemoteSize() {
143143
continue;
144144
}
145145
HeadMethod headMethod = new HeadMethod(downloadUrl);
146+
headMethod.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT);
146147
try {
147148
if (client.executeMethod(headMethod) != HttpStatus.SC_OK) {
148149
continue;

core/src/main/java/org/apache/cloudstack/direct/download/HttpDirectTemplateDownloader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ protected Pair<Boolean, String> performDownload() {
115115
public boolean checkUrl(String url) {
116116
HeadMethod httpHead = new HeadMethod(url);
117117
httpHead.setFollowRedirects(this.isFollowRedirects());
118+
httpHead.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT);
118119
try {
119120
int responseCode = client.executeMethod(httpHead);
120121
if (responseCode != HttpStatus.SC_OK) {

0 commit comments

Comments
 (0)