Skip to content

Commit 1db439a

Browse files
committed
Conditional Basic Auth
Previously, basic auth headers were added to every DownloadCache request. In the case where there were no basic auth credentials, empty strings were used for the username and password. This was wrong, although tolerated by the primarily used CloudFront. This change ensures that basic auth headers are only added when there are both a username and password specified. [#72253796]
1 parent 0c6c02a commit 1db439a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.idea/copyright/profiles_settings.xml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java-buildpack.iml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@
257257
</component>
258258
<component name="NewModuleRootManager" inherit-compiler-output="false">
259259
<content url="file://$MODULE_DIR$">
260-
<sourceFolder url="file://$MODULE_DIR$/lib/java_buildpack" isTestSource="false" />
261260
<sourceFolder url="file://$MODULE_DIR$/bin" isTestSource="false" />
262-
<sourceFolder url="file://$MODULE_DIR$/spec/bin" isTestSource="true" />
263-
<sourceFolder url="file://$MODULE_DIR$/spec/java_buildpack" isTestSource="true" />
261+
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
262+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
264263
<excludeFolder url="file://$MODULE_DIR$/.idea" />
265264
<excludeFolder url="file://$MODULE_DIR$/.yardoc" />
266265
<excludeFolder url="file://$MODULE_DIR$/build" />
@@ -303,7 +302,7 @@
303302
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.4, rbenv: 1.9.3-p545) [gem]" level="application" />
304303
</component>
305304
<component name="RModuleSettingsStorage">
306-
<LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
305+
<LOAD_PATH number="4" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" string2="$MODULE_DIR$/bin" string3="$MODULE_DIR$/spec/bin" />
307306
<I18N_FOLDERS number="0" />
308307
</component>
309308
</module>

lib/java_buildpack/util/cache/download_cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def update(uri, cached_file)
242242
proxy(uri).start(uri.host, uri.port, http_options(uri)) do |http|
243243
@logger.debug { "HTTP: #{http.address}, #{http.port}, #{http_options(uri)}" }
244244
request = request uri, cached_file
245-
request.basic_auth uri.user, uri.password
245+
request.basic_auth uri.user, uri.password if uri.user && uri.password
246246

247247
failures = 0
248248
begin

0 commit comments

Comments
 (0)