htsjdk icon indicating copy to clipboard operation
htsjdk copied to clipboard

htsget requests are not following redirects?

Open jrobinso opened this issue 3 years ago • 2 comments

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 [email protected]/htsjdk.samtools.util.htsget.HtsgetRequest.getResponse(HtsgetRequest.java:286) at [email protected]/htsjdk.samtools.HtsgetBAMFileReader.(HtsgetBAMFileReader.java:135) at [email protected]/htsjdk.samtools.HtsgetBAMFileReader.fromHtsgetURI(HtsgetBAMFileReader.java:81)

jrobinso avatar Dec 24 '21 06:12 jrobinso

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?

andersleung avatar Jan 13 '22 15:01 andersleung

@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 avatar Jan 13 '22 15:01 jrobinso

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

jrobinso avatar Sep 29 '23 05:09 jrobinso