tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Downey <steve.dow...@netfolio.com>
Subject Re: Watchdog aggregation of headers may be incorrect
Date Sun, 18 Aug 2002 13:24:11 GMT
On Sunday 18 August 2002 08:39 am, Remy Maucherat wrote:
> Steve Downey wrote:
> > On Saturday 17 August 2002 01:40 pm, Remy Maucherat wrote:
> >>Steve Downey wrote:
> >
> > <SNIP/>
> >
> >>>The real problem, for the servlet spec implementation, is that not just
> >>>getHeaders() is affected. getHeader() must be also. getHeader, if there
> >>>are multiple values, needs to return the same thing as the first value
> >>>returned by getHeaders(), not the whole header from the first of
> >>> multiple headers.
> >>
> >>Sorry, but no. The opposite statement doesn't work.
> >>getHeader MUST return the first header line, unless in the case there
> >>are multiple headers with the same name in the client message, in which
> >>case you would know that they can be parsed/combined at will.
> >>
> >>Since it is too complex and inefficient to implement that, I'd leave it
> >>at that, and let the application handle the cases where the client is
> >>having some fun.
> >>
> >>Remy
> >
> > Given:
> > H:A,B
> > H:C
> >
> > getHeader() should either return ``A'' or ``A,B,C''. Returning ``A,B'',
> > as it does now, can't be right. It introduces semantic differences
> > between multiple headers and comma-separated lists where their must be
> > none.
>
> Yes, it is right.
>
> Consider:
> H: A, B
>
> In that case, getHeader() has to return "A, B" since it is not known if
> this header is comma separated, as per the spec definition.
>

Ah. That's where we're going in separate directions. I'm assuming that it is 
known. The HTTP spec defines which headers are comma separated. So it's just 
a matter of checking against that list in order to know how to treat multiple 
values. According to the current servlet spec we have to, since we need to 
parse out the values for headers that are comma separated lists. 
getHeaders("Date") should not break apart the date into two values.

> In the case:
> H: A, B
> H: C
>
> Well, you have multiple choices, all of which are valid.
> - you may want to return the same thing as above, which means you return
> "A, B"
> - you can also return "A"
>
> Returning "A, B, C" is incorrect, as you have to return the first value
> of the header.
> Since implementing the first option is easier, I'd leave the current
> behavior.
>
> getHeaders indicate that the header is comma separated, so it should be
> parsed. This is not currently done, but indeed it should be done.
> Hacking MimeHeaders can result in a correct *and* efficient implementation.
>

getHeaders() by itself doesn't tell you that the header is comma separated. 
getHeaders("Date") should give you "Wed, 15 Nov 1995 06:25:24 GMT", not 
{"Wed", "15 Nov 1995 06:25:24 GMT"}. 



--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message