You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by George Sexton <ge...@mhsoftware.com> on 2015/12/24 02:09:41 UTC

7.0.67 Possible Regresssion?

I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've 
confirmed this also working under 7.0.55 and not working under 7.0.67 on 
a different machine.

The sequence is:

GET /A.html
POST /A.html <- Returns /A.html
POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work 
either)

on 7.0.65, things work as as expected.

on 7.0.67, the final post returns a 404, not found error.

I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not changed.

Is this change in behavior expected? If the behavior is expected, could 
someone elaborate on what I'm doing wrong, and what I should be doing?

I've got a TCPDUMP capture I can share if someone would like to see it.



-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Re: 7.0.67 Possible Regresssion?

Posted by George Sexton <ge...@mhsoftware.com>.

On 12/23/2015 8:14 PM, Konstantin Kolinko wrote:
> 2015-12-24 5:22 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
>>
>> On 12/23/2015 6:59 PM, Konstantin Kolinko wrote:
>>> 2015-12-24 4:09 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
>>>> I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've
>>>> confirmed this also working under 7.0.55 and not working under 7.0.67 on
>>>> a
>>>> different machine.
>>>>
>>>> The sequence is:
>>>>
>>>> GET /A.html
>>>> POST /A.html <- Returns /A.html
>>>> POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work
>>>> either)
>>>>
>>>> on 7.0.65, things work as as expected.
>>>>
>>>> on 7.0.67, the final post returns a 404, not found error.
>>>>
>>>> I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not
>>>> changed.
>>>>
>>>> Is this change in behavior expected? If the behavior is expected, could
>>>> someone elaborate on what I'm doing wrong, and what I should be doing?
>>> How are you sending the redirect? What API are you using?
>>
>> HttpServletResponse.sendRedirect()
>>
> >From tcpdump that 404 response has "Content-Length: 0".
> (It is visible from access log as well)
>
> It means that error page handling was not involved, as if the error
> was triggered by lower levels of Tomcat.
>
> In the implementation of o.a.c.connector.Response.sendRedirect() [1]
> there is try/catch(IllegalArgumentException e) that does fallback to
> setStatus(SC_NOT_FOUND);
> It may be that it is the cause of 404 status.

The issue is that if the URI is invalid ( e.g. space in a parameter), it 
throws an exception. So:

response.sendRedirect("B.html?value=Some Word")

generates a 404 on the page containing the sendRedirect() call, and 
there's no message indicating what the true nature of the issue is.

I've filed an ER requesting this be logged.

https://bz.apache.org/bugzilla/show_bug.cgi?id=58768



-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Re: 7.0.67 Possible Regresssion?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-12-24 5:22 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
>
>
> On 12/23/2015 6:59 PM, Konstantin Kolinko wrote:
>>
>> 2015-12-24 4:09 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
>>>
>>> I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've
>>> confirmed this also working under 7.0.55 and not working under 7.0.67 on
>>> a
>>> different machine.
>>>
>>> The sequence is:
>>>
>>> GET /A.html
>>> POST /A.html <- Returns /A.html
>>> POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work
>>> either)
>>>
>>> on 7.0.65, things work as as expected.
>>>
>>> on 7.0.67, the final post returns a 404, not found error.
>>>
>>> I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not
>>> changed.
>>>
>>> Is this change in behavior expected? If the behavior is expected, could
>>> someone elaborate on what I'm doing wrong, and what I should be doing?
>>
>> How are you sending the redirect? What API are you using?
>
>
> HttpServletResponse.sendRedirect()
>

>From tcpdump that 404 response has "Content-Length: 0".
(It is visible from access log as well)

It means that error page handling was not involved, as if the error
was triggered by lower levels of Tomcat.

In the implementation of o.a.c.connector.Response.sendRedirect() [1]
there is try/catch(IllegalArgumentException e) that does fallback to
setStatus(SC_NOT_FOUND);
It may be that it is the cause of 404 status.

The use of java.net.URI.create() to parse the location URL here is
new,  trying to avoid using home-grew toAbsolute() URL handling.
Maybe it has issues with the redirect URL that you are using.

Setting useRelativeRedirects="false" will fallback to the old behaviour.


[1] http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_67/java/org/apache/catalina/connector/Response.java?view=markup#l1393


>>
>> There is a new feature, controlled by useRelativeRedirects attribute on
>> Context.
>> You can see it mentioned in release announcement at
>> http://tomcat.apache.org/
>
>
> My assumption was the default was to preserve the old behavior. That's what
> I got reading the changelog. Perhaps I mis-interpreted that.

The useRelativeRedirects setting is documented here:
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: 7.0.67 Possible Regresssion?

Posted by George Sexton <ge...@mhsoftware.com>.

On 12/23/2015 6:59 PM, Konstantin Kolinko wrote:
> 2015-12-24 4:09 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
>> I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've
>> confirmed this also working under 7.0.55 and not working under 7.0.67 on a
>> different machine.
>>
>> The sequence is:
>>
>> GET /A.html
>> POST /A.html <- Returns /A.html
>> POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work
>> either)
>>
>> on 7.0.65, things work as as expected.
>>
>> on 7.0.67, the final post returns a 404, not found error.
>>
>> I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not changed.
>>
>> Is this change in behavior expected? If the behavior is expected, could
>> someone elaborate on what I'm doing wrong, and what I should be doing?
> How are you sending the redirect? What API are you using?

HttpServletResponse.sendRedirect()

>
> There is a new feature, controlled by useRelativeRedirects attribute on Context.
> You can see it mentioned in release announcement at http://tomcat.apache.org/

My assumption was the default was to preserve the old behavior. That's 
what I got reading the changelog. Perhaps I mis-interpreted that.

>> on 7.0.67, the final post returns a 404, not found error.
> Is the 404 error coming from Tomcat?
> In your access log, is there a difference of page URL that users are requesting?

[23/Dec/2015:17:37:37 -0700] "POST /ViewPlanner.html HTTP/1.1" 404 - "https://somehost.mhsoftware.com/ViewPlanner.html?integral=1" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:42:22 -0700] "GET /ViewPlanner.html?integral=1 HTTP/1.1" 200 5019 "http://somehost.mhsoftware.com/Welcome.html?from_login=1" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:42:24 -0700] "POST /ViewPlanner.html HTTP/1.1" 404 - "http://somehost.mhsoftware.com/ViewPlanner.html?integral=1" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:43:35 -0700] "GET /ViewPlanner.html HTTP/1.1" 200 4943 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:43:41 -0700] "POST /ViewPlanner.html HTTP/1.1" 200 5085 "http://somehost.mhsoftware.com/ViewPlanner.html" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:43:44 -0700] "POST /ViewPlanner.html HTTP/1.1" 404 - "http://somehost.mhsoftware.com/ViewPlanner.html" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:45:01 -0700] "GET /ViewPlanner.html HTTP/1.1" 200 5007 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:45:06 -0700] "POST /ViewPlanner.html HTTP/1.1" 200 5840 "http://somehost.mhsoftware.com/ViewPlanner.html" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:45:08 -0700] "POST /ViewPlanner.html HTTP/1.1" 404 - "http://somehost.mhsoftware.com/ViewPlanner.html" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:58:01 -0700] "GET /ViewPlanner.html?integral=1 HTTP/1.1" 200 5829 "http://somehost.mhsoftware.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com
[23/Dec/2015:17:58:05 -0700] "POST /ViewPlanner.html HTTP/1.1" 302 - "http://somehost.mhsoftware.com/ViewPlanner.html?integral=1" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" somehost.mhsoftware.com



>
> You can modify AccessLogValve configuration to dump Location header of
> responses, and compare them.
>
>> I've got a TCPDUMP capture I can share if someone would like to see it.

Sent off-list.

> I would like to see it.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Re: 7.0.67 Possible Regresssion?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-12-24 4:09 GMT+03:00 George Sexton <ge...@mhsoftware.com>:
> I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've
> confirmed this also working under 7.0.55 and not working under 7.0.67 on a
> different machine.
>
> The sequence is:
>
> GET /A.html
> POST /A.html <- Returns /A.html
> POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work
> either)
>
> on 7.0.65, things work as as expected.
>
> on 7.0.67, the final post returns a 404, not found error.
>
> I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not changed.
>
> Is this change in behavior expected? If the behavior is expected, could
> someone elaborate on what I'm doing wrong, and what I should be doing?

How are you sending the redirect? What API are you using?

There is a new feature, controlled by useRelativeRedirects attribute on Context.
You can see it mentioned in release announcement at http://tomcat.apache.org/

> on 7.0.67, the final post returns a 404, not found error.

Is the 404 error coming from Tomcat?
In your access log, is there a difference of page URL that users are requesting?

You can modify AccessLogValve configuration to dump Location header of
responses, and compare them.

>
> I've got a TCPDUMP capture I can share if someone would like to see it.

I would like to see it.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org