samtools / htslib

C library for high-throughput sequencing data formats
Other
783 stars 447 forks source link

Ensure S3 redirects use TLS #1762

Closed daviesrob closed 3 months ago

daviesrob commented 3 months ago

When following a 3xx redirection from AWS, redirect_endpoint_callback() wasn't putting https:// on the new URL. The redirection worked, but dropped back to http. Obviously, this is not desirable.

Fix by prepending https:// to ensure it uses TLS, and adding a bit of error checking to ensure all parts of the new url have been included.

Fixes #1760

daviesrob commented 3 months ago

To reproduce the problem, try:

HTS_S3_ADDRESS_STYLE=path AWS_DEFAULT_REGION=us-east-2 ./test/test_view -vvvvvvvvv -p /dev/null 's3://1000genomes/1000G_2504_high_coverage/data/ERR3243158/HG01785.final.cram' chr2:178523221-178523221

and look for Connected to .* port in the debugging output.