Steve Downey wrote:
> On Sunday 18 August 2002 08:39 am, Remy Maucherat wrote:
> 
>>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.

No, the spec does not define such list. It just defines a list of 
headers which have a special meaning for the protocol itself.

Any application (such as a WebDAV enabled application) can have a set of 
headers which it doesn't want to have comma-tokenized, and doing what 
you suggest would break them.

>>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"}. 

No.

If you could have multiple "Date" headers, then the headers could be 
assembled in a comma separated list without changing the header meaning, 
so getHeaders would return the first value.

If you have only one header (such as here for the special HTTP Date 
header, but it is also true for all other headers, as you cannot 
possibly know what the application wants to do), then you shouldn't 
parse it, and getHeader should always return the full header.

OTOH, if the application calls getHeaders, then it means it considers it 
is a multivalued header, and then the result should be comma tokenized.

Remy


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to