Bug 54119 - HTTP 307 response is not redirected
HTTP 307 response is not redirected
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.8
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-11-08 10:34 UTC by Philippe Mouawad
Modified: 2012-11-08 12:04 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2012-11-08 10:34:32 UTC
Hello,
I have a request that answers with a  307.
JMeter does not redirect it, testing it with Chrome, Safari, IE8, and Firefox 16.0.2, all browsers do the redirection.


Spec says:
" The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s) , since many pre-HTTP/1.1 user agents do not understand the 307 status. Therefore, the note SHOULD contain the information necessary for a user to repeat the original request on the new URI.

If the 307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. "
Comment 1 Sebb 2012-11-08 11:27:43 UTC
What redirect mode are you using? Auto? Follow?
Which HTTP sampler types?
Comment 2 Philippe Mouawad 2012-11-08 11:29:59 UTC
Using follow redirect
HTTP Sampler 4.

The issue is related to the following code in HTTPSampleResult:
    public boolean isRedirect() {
        final String[] REDIRECT_CODES = { "301", "302", "303" }; // NOT 304!
        String code = getResponseCode();
        for (int i = 0; i < REDIRECT_CODES.length; i++) {
            if (REDIRECT_CODES[i].equals(code)) {
                return true;
            }
        }
        return false;
    }

I think 307 should be added + a check that it's a HEAD or GET before following redirect
Comment 3 Philippe Mouawad 2012-11-08 12:04:14 UTC
Date: Thu Nov  8 12:02:06 2012
New Revision: 1407026

URL: http://svn.apache.org/viewvc?rev=1407026&view=rev
Log:
Bug 54119 - HTTP 307 response is not redirected
Bugzilla Id: 54119

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    jmeter/trunk/xdocs/changes.xml


Date: Thu Nov  8 12:03:34 2012
New Revision: 1407028

URL: http://svn.apache.org/viewvc?rev=1407028&view=rev
Log:
Bug 54119 - HTTP 307 response is not redirected
Docs