samtools / htsjdk

A Java API for high-throughput sequencing data (HTS) formats.
http://samtools.github.io/htsjdk/
283 stars 242 forks source link

htsget requests are not following redirects? #1589

Closed jrobinso closed 1 year ago

jrobinso commented 2 years ago

Hi,

All IGV unit tests using the htsget reference server at htsget://htsget.ga4gh.org started failing inexplicably. I think at least one problem might be that the connections do not appear to be following redirects, see the stack trace below.

Unrecognized status code: 301 java.lang.IllegalStateException: Unrecognized status code: 301 at htsjdk@2.24.1/htsjdk.samtools.util.htsget.HtsgetRequest.getResponse(HtsgetRequest.java:286) at htsjdk@2.24.1/htsjdk.samtools.HtsgetBAMFileReader.(HtsgetBAMFileReader.java:135) at htsjdk@2.24.1/htsjdk.samtools.HtsgetBAMFileReader.fromHtsgetURI(HtsgetBAMFileReader.java:81)

andersleung commented 2 years ago

Hi, sorry for the late response. I believe this is due to java's HTTPUrlConnection not following redirects across different protocols for security reasons. It should follow redirects automatically for HTTP -> HTTP or HTTPS -> HTTPS, but I suspect the redirect causing the failure might be from HTTPS -> HTTP or the other way around.

@lbergelson do you think putting in the code to manually follow redirects across protocols, or maybe adding an option to do so would be a good idea?

jrobinso commented 2 years ago

@andersleung @lbergelson I think there are other problems with the reference server, or rather were at the time this was filed. If its the case that the reference is redirecting https -> http I think its a bug with the server, and feel free to close this.

jrobinso commented 1 year ago

The reference server has been down for almost 2 years so I'm closing this.