You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by David Luu <ma...@gmail.com> on 2012/08/11 00:56:08 UTC

HTTP POST to a redirected URL handled properly?

Hi,

This is first time I've come across this topic. By the way, I'm testing
APIs that are under development so things might change, will follow up on
them later but assuming correct server setup:

I make POST to a URL and it returned 302 moved temporarily with new URL.
The redirect is basically changing original URL of HTTP to HTTPS, that's
it. In JMeter, I'm using an HTTP sampler and by default have the follow
redirect option checked. It did follow the redirect but POST request became
a GET and thus all POST data was lost and API call failed. I didn't specify
a specific HTTP client to use, using system default. If it matters, which
HTTP client is best suited for this? I was wondering whether under this
situation JMeter can follow redirect but keep as POST request with same
posted data? If so, how? If not, is this the correct user agent and test
tool behavior to expect when coming across a 302 redirect for POST requests?

Regards,
David

Re: HTTP POST to a redirected URL handled properly?

Posted by Deepak Shetty <sh...@gmail.com>.
Serves me right for relying on wiki pedia . However I do think browsers
implement 302 as GET because there used to be a redirect after post
technique to prevent double submit of forms
On Aug 12, 2012 2:58 AM, "sebb" <se...@gmail.com> wrote:

> On 11 August 2012 19:08, Deepak Shetty <sh...@gmail.com> wrote:
> > Hi
> > I think you are referring to a status code of 307 - Since almost all web
> > apps use 302 as the status code , I believe everything is converted into
> a
> > GET normally (though supposedly this contradicts what was meant to be
> > implemented)
> >
> > http://en.wikipedia.org/wiki/HTTP_307#3xx_Redirection
>
> AFAICT Wikipedia disagrees with the RFC here.
>
> https://tools.ietf.org/html/rfc2616#section-10.3.8
>
> Wikipedia says that 307 redirects should preserve the method; RFC 2616
> says specifically that only HEAD and GET should be automatically
> re-issued.
>
> > regards
> > deepak
> >
> > On Aug 11, 2012 4:23 AM, "sebb" <se...@gmail.com> wrote:
> >
> >> On 11 August 2012 00:03, Deepak Shetty <sh...@gmail.com> wrote:
> >> >> If not, is this the correct user agent and test tool behavior to
> expect
> >> > when coming across a 302 redirect for POST requests?
> >> > Yes a  redirect is always a GET
> >>
> >> AIUI if a POST is redirected, the client is supposed to prompt the
> >> user to get agreement that the redirect is OK.
> >>
> >> Only GET requests can be automatically redirected.
> >>
> >> You'll need to change the test plan to use the redirect URL instead.
> >>
> >> > regards
> >> > deepak
> >> >
> >> > On Fri, Aug 10, 2012 at 3:56 PM, David Luu <ma...@gmail.com>
> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> This is first time I've come across this topic. By the way, I'm
> testing
> >> >> APIs that are under development so things might change, will follow
> up
> >> on
> >> >> them later but assuming correct server setup:
> >> >>
> >> >> I make POST to a URL and it returned 302 moved temporarily with new
> URL.
> >> >> The redirect is basically changing original URL of HTTP to HTTPS,
> that's
> >> >> it. In JMeter, I'm using an HTTP sampler and by default have the
> follow
> >> >> redirect option checked. It did follow the redirect but POST request
> >> became
> >> >> a GET and thus all POST data was lost and API call failed. I didn't
> >> specify
> >> >> a specific HTTP client to use, using system default. If it matters,
> >> which
> >> >> HTTP client is best suited for this? I was wondering whether under
> this
> >> >> situation JMeter can follow redirect but keep as POST request with
> same
> >> >> posted data? If so, how? If not, is this the correct user agent and
> test
> >> >> tool behavior to expect when coming across a 302 redirect for POST
> >> >> requests?
> >> >>
> >> >> Regards,
> >> >> David
> >> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> >> For additional commands, e-mail: user-help@jmeter.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: HTTP POST to a redirected URL handled properly?

Posted by sebb <se...@gmail.com>.
On 11 August 2012 19:08, Deepak Shetty <sh...@gmail.com> wrote:
> Hi
> I think you are referring to a status code of 307 - Since almost all web
> apps use 302 as the status code , I believe everything is converted into a
> GET normally (though supposedly this contradicts what was meant to be
> implemented)
>
> http://en.wikipedia.org/wiki/HTTP_307#3xx_Redirection

AFAICT Wikipedia disagrees with the RFC here.

https://tools.ietf.org/html/rfc2616#section-10.3.8

Wikipedia says that 307 redirects should preserve the method; RFC 2616
says specifically that only HEAD and GET should be automatically
re-issued.

> regards
> deepak
>
> On Aug 11, 2012 4:23 AM, "sebb" <se...@gmail.com> wrote:
>
>> On 11 August 2012 00:03, Deepak Shetty <sh...@gmail.com> wrote:
>> >> If not, is this the correct user agent and test tool behavior to expect
>> > when coming across a 302 redirect for POST requests?
>> > Yes a  redirect is always a GET
>>
>> AIUI if a POST is redirected, the client is supposed to prompt the
>> user to get agreement that the redirect is OK.
>>
>> Only GET requests can be automatically redirected.
>>
>> You'll need to change the test plan to use the redirect URL instead.
>>
>> > regards
>> > deepak
>> >
>> > On Fri, Aug 10, 2012 at 3:56 PM, David Luu <ma...@gmail.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> This is first time I've come across this topic. By the way, I'm testing
>> >> APIs that are under development so things might change, will follow up
>> on
>> >> them later but assuming correct server setup:
>> >>
>> >> I make POST to a URL and it returned 302 moved temporarily with new URL.
>> >> The redirect is basically changing original URL of HTTP to HTTPS, that's
>> >> it. In JMeter, I'm using an HTTP sampler and by default have the follow
>> >> redirect option checked. It did follow the redirect but POST request
>> became
>> >> a GET and thus all POST data was lost and API call failed. I didn't
>> specify
>> >> a specific HTTP client to use, using system default. If it matters,
>> which
>> >> HTTP client is best suited for this? I was wondering whether under this
>> >> situation JMeter can follow redirect but keep as POST request with same
>> >> posted data? If so, how? If not, is this the correct user agent and test
>> >> tool behavior to expect when coming across a 302 redirect for POST
>> >> requests?
>> >>
>> >> Regards,
>> >> David
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: HTTP POST to a redirected URL handled properly?

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
I think you are referring to a status code of 307 - Since almost all web
apps use 302 as the status code , I believe everything is converted into a
GET normally (though supposedly this contradicts what was meant to be
implemented)

http://en.wikipedia.org/wiki/HTTP_307#3xx_Redirection

regards
deepak

On Aug 11, 2012 4:23 AM, "sebb" <se...@gmail.com> wrote:

> On 11 August 2012 00:03, Deepak Shetty <sh...@gmail.com> wrote:
> >> If not, is this the correct user agent and test tool behavior to expect
> > when coming across a 302 redirect for POST requests?
> > Yes a  redirect is always a GET
>
> AIUI if a POST is redirected, the client is supposed to prompt the
> user to get agreement that the redirect is OK.
>
> Only GET requests can be automatically redirected.
>
> You'll need to change the test plan to use the redirect URL instead.
>
> > regards
> > deepak
> >
> > On Fri, Aug 10, 2012 at 3:56 PM, David Luu <ma...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> This is first time I've come across this topic. By the way, I'm testing
> >> APIs that are under development so things might change, will follow up
> on
> >> them later but assuming correct server setup:
> >>
> >> I make POST to a URL and it returned 302 moved temporarily with new URL.
> >> The redirect is basically changing original URL of HTTP to HTTPS, that's
> >> it. In JMeter, I'm using an HTTP sampler and by default have the follow
> >> redirect option checked. It did follow the redirect but POST request
> became
> >> a GET and thus all POST data was lost and API call failed. I didn't
> specify
> >> a specific HTTP client to use, using system default. If it matters,
> which
> >> HTTP client is best suited for this? I was wondering whether under this
> >> situation JMeter can follow redirect but keep as POST request with same
> >> posted data? If so, how? If not, is this the correct user agent and test
> >> tool behavior to expect when coming across a 302 redirect for POST
> >> requests?
> >>
> >> Regards,
> >> David
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: HTTP POST to a redirected URL handled properly?

Posted by sebb <se...@gmail.com>.
On 11 August 2012 00:03, Deepak Shetty <sh...@gmail.com> wrote:
>> If not, is this the correct user agent and test tool behavior to expect
> when coming across a 302 redirect for POST requests?
> Yes a  redirect is always a GET

AIUI if a POST is redirected, the client is supposed to prompt the
user to get agreement that the redirect is OK.

Only GET requests can be automatically redirected.

You'll need to change the test plan to use the redirect URL instead.

> regards
> deepak
>
> On Fri, Aug 10, 2012 at 3:56 PM, David Luu <ma...@gmail.com> wrote:
>
>> Hi,
>>
>> This is first time I've come across this topic. By the way, I'm testing
>> APIs that are under development so things might change, will follow up on
>> them later but assuming correct server setup:
>>
>> I make POST to a URL and it returned 302 moved temporarily with new URL.
>> The redirect is basically changing original URL of HTTP to HTTPS, that's
>> it. In JMeter, I'm using an HTTP sampler and by default have the follow
>> redirect option checked. It did follow the redirect but POST request became
>> a GET and thus all POST data was lost and API call failed. I didn't specify
>> a specific HTTP client to use, using system default. If it matters, which
>> HTTP client is best suited for this? I was wondering whether under this
>> situation JMeter can follow redirect but keep as POST request with same
>> posted data? If so, how? If not, is this the correct user agent and test
>> tool behavior to expect when coming across a 302 redirect for POST
>> requests?
>>
>> Regards,
>> David
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: HTTP POST to a redirected URL handled properly?

Posted by Deepak Shetty <sh...@gmail.com>.
> If not, is this the correct user agent and test tool behavior to expect
when coming across a 302 redirect for POST requests?
Yes a  redirect is always a GET

regards
deepak

On Fri, Aug 10, 2012 at 3:56 PM, David Luu <ma...@gmail.com> wrote:

> Hi,
>
> This is first time I've come across this topic. By the way, I'm testing
> APIs that are under development so things might change, will follow up on
> them later but assuming correct server setup:
>
> I make POST to a URL and it returned 302 moved temporarily with new URL.
> The redirect is basically changing original URL of HTTP to HTTPS, that's
> it. In JMeter, I'm using an HTTP sampler and by default have the follow
> redirect option checked. It did follow the redirect but POST request became
> a GET and thus all POST data was lost and API call failed. I didn't specify
> a specific HTTP client to use, using system default. If it matters, which
> HTTP client is best suited for this? I was wondering whether under this
> situation JMeter can follow redirect but keep as POST request with same
> posted data? If so, how? If not, is this the correct user agent and test
> tool behavior to expect when coming across a 302 redirect for POST
> requests?
>
> Regards,
> David
>