On Thu, 21 Feb 2002, Lavandowska wrote:
> Date: Thu, 21 Feb 2002 11:33:38 -0800 (PST)
> From: Lavandowska <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> Subject: Re: HTTP Headers [was RE: Commons Util 1.0 release candidate 1]
>
>
> --- "Waldhoff, Rodney" <[EMAIL PROTECTED]> wrote:
> > > the "header" stuff could be done simply
> > > with a case-insensitive comparision due
> > > to different containers using either
> > > "-" or "_" to seperate header names.
> >
> > But "User-Agent" and "User_Agent" are different headers (while
> > "UsEr-AgEnT",
> > "USER-AGENT", and "user-agent" are the the same) per the HTTP spec,
> > yes? If
> > the container is sending "Content_Length" when it means
> > "Content-Length",
> > that's a bug in the container, yes?
>
> I've always considered "User-Agent" and "User_Agent" to be the same
> header. I've never checked any specs to see if the header should be
> done one way or the other. All I know is that there is *NO*
> consistency between containers, thus I couldn't ever write
> getHeader("User-Agent") and be certain that it will migrate well from
> one container to another. In fact, this is exactly the problem that
> lead to this solution.
>
> I hadn't read the Servlet spec closely enough to realize getHeader() is
> supposed to be case-agnostic, otherwise I would have reported a bug
> against the particular containers where it was a problem. (I don't use
> them anymore anyway).
>
This is actually defined in the HTTP spec, which servlets depend on.
Per RFC 2616, Section 4.2, header names are case insensitive. However,
that does *not* mean that "-" and "_" are interchangeable -- only letters
have cases.
Per RFC 2616, Section 14.43, the correct header is "User-Agent".
> Lance
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>