hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: "<" character in a response header
Date Thu, 22 Mar 2007 17:32:33 GMT
On Thu, 2007-03-22 at 22:24 +0530, Asankha C. Perera wrote:
> Hi Oleg
> 
> I still I couldn't figure out the problem.. on a different note, since 
> the API gives me the method setHeader(String, String), I am wondering if 
> the user is responsible for the escaping or he could provide any String 
> and HttpCore should correctly escape it if required.
> 

Hi Asankha,

Please forget all that nonsense I have said. I must have been blind.

field-content  = <the OCTETs making up the field-value
                        and consisting of either *TEXT or combinations
                        of token, separators, and quoted-string>

TEXT           = <any OCTET except CTLs,
                        but including LWS>

OCTET          = <any 8-bit sequence of data>

Only control characters ((octets 0 - 31) and DEL (127)) must be escaped,
which character "<" is not. 

> But more importantly, I cannot still find out why all the headers loose 
> the CRLF at the end, just when I add a header with the "<" character? 
> Will try to debug some more and see what I come up with...
> 

What kind of HTTP software is being used on the client side? Are there
any proxies involved? 

Oleg


> asankha
> 
> 
> >>
> >> My problem is that if I try to add a response header that contains 
> >> the "<" character (say response.setHeader("lll", "hh<ff"); ) the 
> >> output gets garbled. i.e.
> >>
> >> HTTP/1.1 200 OK
> >> lll: hh<ffContent-Type: text/xml; charset=UTF-8Date: Wed, 21 Mar 2007 
> >> 19:31:06 GMTServer: Synapse-HttpComponents-NIOTransfer-Encoding: chunked
> >> 451
> >>
> >> vs
> >>
> >> HTTP/1.1 200 OK
> >> Content-Type: text/xml; charset=UTF-8
> >> Date: Wed, 21 Mar 2007 19:31:38 GMT
> >> Server: Synapse-HttpComponents-NIO
> >> Transfer-Encoding: chunked
> >>
> >> 450
> >>
> >> if that header with the "<" was not set. Could someone explain this 
> >> to me?
> >> thanks
> >> asankha
> >>
> > Asankha
> >
> > HTTP header content may consist of "either *TEXT or combinations of 
> > token, separators, and quoted-string". [1] According to the basic 
> > rules [2] of the HTTP protocol character "<" is illegal for TEXT, but 
> > is allowed inside a quoted string as a quoted pair. So, to be valid 
> > according to the strict interpretation of the HTTP spec the header 
> > should look like
> >
> > ll: "hh\<ff"
> >
> > HttpCore is quite lenient about the format of HTTP headers and should 
> > be to parse ll: hh<ff just fine, but other HTTP clients may be a 
> > little pickier.
> >
> > Hope this helps
> >
> > Oleg
> >
> > [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
> > [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
> >
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: 
> >> httpcomponents-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: 
> >> httpcomponents-dev-help@jakarta.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> > httpcomponents-dev-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message