Skip to content

add user-agent header to template downloader request#12791

Open
sudo87 wants to merge 2 commits intoapache:4.22from
shapeblue:addUserAgentTemplateDownload
Open

add user-agent header to template downloader request#12791
sudo87 wants to merge 2 commits intoapache:4.22from
shapeblue:addUserAgentTemplateDownload

Conversation

@sudo87
Copy link
Contributor

@sudo87 sudo87 commented Mar 11, 2026

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@sudo87 sudo87 requested a review from sureshanaparti March 11, 2026 12:34
@sudo87
Copy link
Contributor Author

sudo87 commented Mar 11, 2026

@blueorangutan package

@blueorangutan
Copy link

@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
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.60%. Comparing base (7aa0558) to head (c1eb8a5).
⚠️ Report is 3 commits behind head on 4.22.

Files with missing lines Patch % Lines
...cloud/storage/template/HttpTemplateDownloader.java 0.00% 1 Missing ⚠️
...d/storage/template/MetalinkTemplateDownloader.java 0.00% 1 Missing ⚠️
...torage/template/SimpleHttpMultiFileDownloader.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12791      +/-   ##
============================================
- Coverage     17.61%   17.60%   -0.01%     
+ Complexity    15664    15657       -7     
============================================
  Files          5917     5917              
  Lines        531402   531415      +13     
  Branches      64971    64972       +1     
============================================
- Hits          93596    93579      -17     
- Misses       427252   427281      +29     
- Partials      10554    10555       +1     
Flag Coverage Δ
uitests 3.70% <ø> (-0.01%) ⬇️
unittests 18.68% <25.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 17096

@weizhouapache
Copy link
Member

@sudo87
code looks ok

any linked issue ?

@sureshanaparti
Copy link
Contributor

@sudo87 code looks ok

any linked issue ?

@weizhouapache it seems no linked issue for this.

@sureshanaparti
Copy link
Contributor

@sudo87 check if the user-agent update is relavent in createRequest() at MetalinkTemplateDownloader, SimpleHttpMultiFileDownloader, HttpDirectTemplateDownloader.

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@sudo87
Copy link
Contributor Author

sudo87 commented Mar 12, 2026

@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.

@sureshanaparti
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@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
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants