Bug 55450 - HEAD redirects should remain as HEAD
Summary: HEAD redirects should remain as HEAD
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.9
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-19 17:13 UTC by Sebb
Modified: 2013-08-19 21:24 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebb 2013-08-19 17:13:29 UTC
At present, all redirected requests are forced to use GET.

This is wrong, at the very least HEAD requests should remain as HEAD requests.

The full rules are at:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3

Note: Many web sites say that 307 should retain the same method.
However, AFAICT that was a proposal only as part of 
https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#page-56
This has not been ratified, so JMeter should proceed as per RFC2616 for now.
Comment 1 Sebb 2013-08-19 21:02:19 UTC
JMeter 2.9 changes all methods to GET for the codes 301, 302, 303.
It does not treat 307 as a redirect.

According to the spec:

301 - should not automatically redirect except GET/HEAD; however some HTTP/1.0 agents do so (as does JMeter)

302 - should not automatically redirect except GET/HEAD; however most agents do so (incl. JMeter)

303 - should redirect POST using GET; JMeter does this. The spec is not clear if HEAD should be redirected as GET or if it should be redirected as HEAD.

307 - should not automatically redirect except GET/HEAD;

It looks like the fixes needed are as follows:

301,301,303: change code so HEAD is redirected as HEAD.

307: add code to redirect IF method is GET or HEAD only, and keep the method unchanged.
Comment 2 Philippe Mouawad 2013-08-19 21:05:21 UTC
Hello sebb,
have a look at 54119

Regards
Philippe
Comment 3 Sebb 2013-08-19 21:07:50 UTC
(In reply to Sebb from comment #1)
> 
> 307: add code to redirect IF method is GET or HEAD only, and keep the method
> unchanged.

Oops, I see that 307 is already handled correctly; should have spotted that.
Comment 4 Sebb 2013-08-19 21:24:47 UTC
URL: http://svn.apache.org/r1515608
Log:
HEAD redirects should remain as HEAD
Bugzilla Id: 55450

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml
Comment 5 The ASF infrastructure team 2022-09-24 20:37:54 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3199