Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses an issue where HTTP redirects for
ctx.download()
/ctx.download_and_extract()
do not properly forward auth headers after an HTTP redirect (3** status code). This was due to auth headers being tied to the exact URL given in theurls
parameter.This PR addresses this by additionally tying auth data to the host name (matching what is given in
auth
). This is backwards compatible with existing "exact URL matching" functionality by having the host auth functionality largely function as a fallback.For more detail see: #25068
Changes:
use_netrc()
intools/build_defs/repo/utils.bzl
.patterns
dict.URL
s (requires protocol).patterns
which do not appear in theurls
at all (so redirects would need to be still among the same set of hosts).Returns
section of doc string to mention the pattern hosts.http_archive()
and others which useuse_netrc()
(possibly throughget_auth()
) for generating auth data.HttpConnectorMultiplexer.getHeaderFunction()
insrc/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpConnectorMultiplexer.java
.credentials
for both the exact URI and a URI of only the host, where the host is a fallback (overridden by the exact URI).URL
requires protocol).use_netrc()
(and passed through various functions/transformations).download()
anddownload_and_extract()
doc strings insrc/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java
.test_use_netrc
test case insrc/test/shell/bazel/starlark_repository_test.sh
.expected
dict auth data.testHeaderComputationFunction()
insrc/test/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpConnectorMultiplexerTest.java
.Fixes #25068.