Skip to content

feature/http-gzip-index.yaml - #32478

Open
rafal-prasal wants to merge 1 commit into
helm:mainfrom
rafal-prasal:feature/http-gzip-index.yaml
Open

feature/http-gzip-index.yaml#32478
rafal-prasal wants to merge 1 commit into
helm:mainfrom
rafal-prasal:feature/http-gzip-index.yaml

Conversation

@rafal-prasal

Copy link
Copy Markdown

What this PR does / why we need it:

As index.yaml can become big, sending it uncompressed over network becomes a problem.
Fortunately web servers offer compression of content on the fly.
http client must come with proper headers and then server responds accordingly if it supports it.

How it works
client -> "Accept-Encoding: gzip"
server -> "Content-Encoding: gzip"
server -> gzipped content

Special notes for your reviewer:

this solution is completely transparent. it will work only when web server supports it.
it is added only in case of reaching for index.yaml. otherwise httpClient works as before.

If applicable:

  • this PR has been tested for backwards compatibility

@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 27, 2026
@github-actions github-actions Bot added the v4.x Issues and Pull Requests related to the major version v4 label Jul 27, 2026
Signed-off-by: Rafal Prasal <rafal.prasal@gmail.com>
@rafal-prasal
rafal-prasal force-pushed the feature/http-gzip-index.yaml branch from 77d2038 to 24a980a Compare July 27, 2026 12:14
@rafal-prasal

rafal-prasal commented Jul 27, 2026

Copy link
Copy Markdown
Author

this resolves #32479

@rafal-prasal

Copy link
Copy Markdown
Author

this is pull request i created. i believe it is more compliant with HTTP headers behaviour

#32478

Comment thread pkg/getter/httpgetter.go
return nil, err
}

isRepositoryIndexRequest := isRepositoryIndexRequestURL(href)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use an option e.g. WithAcceptCompression() so the caller may specify compression should be enabled, rather than "hard-coding" index.yaml.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves chart repository index downloads by enabling transparent gzip compression support for index.yaml fetches, reducing network transfer size when servers support Content-Encoding: gzip.

Changes:

  • Add Accept-Encoding: gzip for index.yaml HTTP requests and transparently decompress gzipped responses.
  • Add a repository-level test covering gzipped index.yaml downloads.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/repo/v1/chartrepo_test.go Adds a test server that serves a gzipped index.yaml and verifies Helm writes the decompressed content to cache.
pkg/getter/httpgetter.go Adds gzip accept/decode logic gated to repository index.yaml requests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +136 to +140
gzipWriter := gzip.NewWriter(w)
defer gzipWriter.Close()

_, err := gzipWriter.Write(fileBytes)
require.NoError(t, err)
Comment thread pkg/getter/httpgetter.go
Comment on lines +112 to +115
gzipReader, err := gzip.NewReader(resp.Body)
if err != nil {
return nil, err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. v4.x Issues and Pull Requests related to the major version v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants