HTTP2 Request doesn't follow redirects in JMet

2019-07-19 12:32发布

问题:

I'm using the HTTP2 plugin for JMeter from Blazemeter and I'm unable to make the HTTP2 request follow the redirects. I tried checking the "Follow Redirects" box and "Synchronized Request" and it doesn't work.

I get the Response code: 301 & Response message: HTTP/2.0 301 Moved Permanently and the location where it should redirect in the Response headers => "location".

I am trying to make a HTTP2 request to "www.aoro.ro" (GET https://www.aoro.ro/) which should redirect me to "https://www.notino.ro/" but does not follow the location it gets from the Reponse headers: HTTP/2.0 301 Moved Permanently location: https://www.notino.ro/ and I'm stuck with this response and cannot use assertions based on the redirects.

I also tried to use "HTTP Header Manager" and send all the headers from the browser. I read that HTTP2 version of HTTP protocol is asynchronous and this may interfere with the redirect.

Do you know anything regarding the Redirecting on JMeter with HTTP2 plugin?

回答1:

I confirm it's a bug of HTTP2 Request that I reported here (as there is no issue reporting in their github):

  • https://groups.google.com/forum/#!topic/jmeter-plugins/ww-c5BkuRu4

What you can do is handle it yourself using Regular Expression Extractor:

And add it like this:

Then use ${REDIRECT} in path field of another HTTP2 Request:



回答2:

After a deeper research about the blazemeter.jmeter.http2.sampler I found out that the HTTP2 sampler request does not have the followRedirects() method implemented in the HTTP2Request.class file.

To get to this file you have to extract files from jmeter-bzm-http2-1.4.jar file from lib.ext folder and the .class files will be in com\blazemeter\jmeter\http2\sampler folder. After this step you have to decompile HTTP2Request.class file (did it using the online tool : https://devtoolzone.com/decompiler/java) and open it using Notepad++ / Sublime or any other program to see the script.

So until a new version of this plugin is released, Follow Redirects/ Autoredirect will not work (no implementation of it)