CC: Tweaked

CC: Tweaked

42M Downloads

Returns null when response code 304 is send by a website

KrystianMalecki opened this issue ยท 2 comments

commented

I'm trying to get responses from my web page and i'm receiving response code 304. (it is hosted on Vercel so i don't know how to change response code)
This code is blocked in HttpRequestHandler on line 238.

 private URI getRedirect( HttpResponseStatus status, HttpHeaders headers )
    {
        int code = status.code();
        if( code < 300 || code > 307 || code == 304 || code == 306 ) return null;

Is it an intended feature or is it just a bug?

commented

I'm afraid I cannot reproduce this. I just created a small local server, and 304 requests are returned as expected:

http working with 304 responses

The getRedirect function is used to process Location headers, which are not valid for HTTP requests returning 304. If this function returns null, normal processing of the request should continue below.


Worth noting that that code is incorrect. We should handle 201, 301, 302, 303, 307, 308 responses, not whatever this mishmash is. Not sure why this code is like this, but it shouldn't be causing this bug either way.

commented

Oh sanp, i misinterpreted it what it means. The error is on my side. Sorry for bothering you