Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Modify order of headers returned

I fully understand the order should not matter. I have an android app that on certain platforms loses the JSESSION cookie. I captured the traffic with wireshark on a working version of jetty 7.02 and the latest version of 8. The only difference was that the Expires header was sent first on the working 7.02 then the Set-Coookie for JSESSIONID. Now in the latest version of 8, the Set-Cookie for JSESSIONID was sent first and that the client does not get set. I know its ugly and hacky and I shouldnt have to do it.

Thats why I was wondering if I could plug into where the actual streak response is sent back to modify or at least insert an initial header before any cookies get set.


On Tue, Feb 19, 2013 at 10:08 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
That's a violation of the RFC2616 - The HTTP/1.1 spec.

"The order in which header fields with differing field names are received is not significant."

Header field order is only relevant when there are multiple message-headers with the same field-name value.

We have no tests in jetty to test for header order beyond the requirement for multiple values across a common name field.
The client library that you are using needs to conform to the HTTP/1.1, as any hack you come up with on the server side will not work reliably or predictably now or in the future.

An ugly hack, which is not guaranteed to work in the latest Jetty 9 (for example), would be to have a javax.servlet.Filter that sets a response Cookie header as the first thing it does before it forwards the request to the javax.servlet.FilterChain.doFilter(request,response).  This *might* have the desired end result you want.  But this behavior is just relying on the unpredictable nature of the order in/out of a java.util.Map implementation, which is unspecified.

Joakim Erdfelt <joakim@xxxxxxxxxxx>
Developer advice, services and support
from the Jetty & CometD experts

On Tue, Feb 19, 2013 at 7:38 AM, Mack Gerhardt <mack@xxxxxxxxxxxxxx> wrote:
Is it possible to modify the actual output stream so that one could modify headers, change order of headers sent?

I have an issue where a client in the field uses a mobile phone with a library that fails on reading in cookies on the latest version of jetty 7,8,9 because the Set-Cookie JSESSIONID header comes right after the request. In a prior version 7.0.2 the Expires header is the first returned before Set-Cookie.

I would like to move up to the latest version of Jetty which is used in an embedded server and modify the actual response being sent back. If you could point me in a direction that would be great.


jetty-users mailing list

jetty-users mailing list

Back to the top