add user-agent header to template downloader request#12791
add user-agent header to template downloader request#12791sudo87 wants to merge 5 commits intoapache:4.22from
Conversation
|
@blueorangutan package |
|
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12791 +/- ##
============================================
- Coverage 17.61% 17.61% -0.01%
- Complexity 15664 15676 +12
============================================
Files 5917 5918 +1
Lines 531402 531557 +155
Branches 64971 64986 +15
============================================
+ Hits 93596 93611 +15
- Misses 427252 427389 +137
- Partials 10554 10557 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 17096 |
|
@sudo87 any linked issue ? |
core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java
Outdated
Show resolved
Hide resolved
@weizhouapache it seems no linked issue for this. |
|
@sudo87 check if the user-agent update is relavent in createRequest() at MetalinkTemplateDownloader, SimpleHttpMultiFileDownloader, HttpDirectTemplateDownloader. |
Thanks @sureshanaparti for your feedback on the pr. I think there is no harm adding user-agent in the GetMethod request, updated the pr accordingly. |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17116 |
|
@blueorangutan test |
|
@sudo87 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-15638)
|
vishesh92
left a comment
There was a problem hiding this comment.
The code looks good. My only concern (not sure about the impact) is the value for the user agent. We should ensure it matches the format as per the RFC. below is the output from quick web search.
Ref:
https://www.rfc-editor.org/rfc/rfc9110.html#section-10.1.5
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/User-Agent
|
Thank you @vishesh92 for review and suggestion. Changed the user agent to follow RFC format, e.g.: Please let me know if this makes sense. |
7a13c88 to
6fd80d6
Compare
|
@blueorangutan package |
|
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17231 |
|
[LL] Trillian Build Failed (tid-7181) |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
There is a URL validity check done by the management server, which still shows up on the webserver as "Java/17.0.18". The SSVM file download shows "CloudStack-Agent/4.22.1.0-SNAPSHOT (Apache CloudStack)" . Do you think the management server also needs to be fixed? |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17252 |
Thank you @rajujith for suggestion, it would be wise to add user-agent in HEAD request as well. I have updated the pr accordingly. |
|
@blueorangutan package |
|
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17253 |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
@blueorangutan package |
|
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17262 |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17263 |
rajujith
left a comment
There was a problem hiding this comment.
LGTM
Tested
10.x.x.x- - [27/Mar/2026:11:28:09 +0000] "HEAD /jithintemplates/alpine-router.qcow2 HTTP/1.1" 200 271 "-" "CloudStack-Agent/4.22.1.0-SNAPSHOT (Apache CloudStack)"
10.x.x.x - - [27/Mar/2026:11:28:09 +0000] "GET /jithintemplates/alpine-router.qcow2 HTTP/1.1" 200 336462039 "-" "CloudStack-Agent/4.22.1.0-SNAPSHOT (Apache CloudStack)"
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-15754)
|
Description
This PR adds user-agent header to download request.
Some template providers reject HTTP requests without a User-Agent
header and return HTTP 403 instead of redirecting to the actual
download location. This causes template downloads to fail.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?