You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adrian Fretwell <ad...@topgreen.co.uk> on 2011/02/17 15:38:07 UTC

CRLF in HTTP headers

Tomcat 6.0.32
Hello,
I am struggling a little with what may be a simple issue:

When I send a request to my installation of Tomcat (including any of the 
example servlets) the HTTP response headers returned are separated by 
only a line feed (0A).
I have a Hermes2 application running under tomcat as a B2B Gateway.  
When trying to connect to us, our partners system complains that "*HTTP 
response line not terminated by CRLF*. "  (0D0A) and throws an exception.

Can anyone tell me how (or the correct way) to configure Tomcat to 
ensure it sends CRLF and not just LF?

Many thanks in advance.

Kind regards,

Adrian.


Re: CRLF in HTTP headers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adrian,

On 2/17/2011 10:51 AM, Adrian Fretwell wrote:
> Thank you for your feedback, I have just confirmed CRLF is actually
> present by using http://www.askapache.com/online-tools/http-headers-tool/
> When I grab the headers myself in a hex dump, only LF is present. 
> Something must be stripping the CR out.

If your (or some library) code is using Reader.readline then it will
remove environment-specific newline characters (that would be CR on
older Mac OS, CRLF on DOS-based OSs including Microsoft Windows, and LF
on *NIX environments). Unless you're running Mac OS 9 or something, I
would be surprised if this is the cause.

It's a little unclear from your statement above: where can you observe
the correct CRLF separators and where can you observe the absence of the
CR characters?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1kEBoACgkQ9CaO5/Lv0PDc8gCgi/n+oVrvppujWSQ26oS0V7nz
bW4An1W60GanktsowfLOHlyJfDjZqESl
=TiFM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: CRLF in HTTP headers

Posted by Adrian Fretwell <ad...@topgreen.co.uk>.
Mark,
Thank you for your feedback, I have just confirmed CRLF is actually 
present by using http://www.askapache.com/online-tools/http-headers-tool/
When I grab the headers myself in a hex dump, only LF is present.  
Something must be stripping the CR out.

Thank you for the confirmation.

Kind regards,
Adrian.

On 17/02/11 15:08, Mark Thomas wrote:
> On 17/02/2011 14:38, Adrian Fretwell wrote:
>> Tomcat 6.0.32
>> Hello,
>> I am struggling a little with what may be a simple issue:
>>
>> When I send a request to my installation of Tomcat (including any of the
>> example servlets) the HTTP response headers returned are separated by
>> only a line feed (0A).
>> I have a Hermes2 application running under tomcat as a B2B Gateway.
>> When trying to connect to us, our partners system complains that "*HTTP
>> response line not terminated by CRLF*. "  (0D0A) and throws an exception.
>>
>> Can anyone tell me how (or the correct way) to configure Tomcat to
>> ensure it sends CRLF and not just LF?
> Tomcat always (since it is required by the HTTP spec) sends header lines
> terminated with CRLF.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: CRLF in HTTP headers

Posted by Mark Thomas <ma...@apache.org>.
On 17/02/2011 14:38, Adrian Fretwell wrote:
> Tomcat 6.0.32
> Hello,
> I am struggling a little with what may be a simple issue:
> 
> When I send a request to my installation of Tomcat (including any of the
> example servlets) the HTTP response headers returned are separated by
> only a line feed (0A).
> I have a Hermes2 application running under tomcat as a B2B Gateway. 
> When trying to connect to us, our partners system complains that "*HTTP
> response line not terminated by CRLF*. "  (0D0A) and throws an exception.
> 
> Can anyone tell me how (or the correct way) to configure Tomcat to
> ensure it sends CRLF and not just LF?

Tomcat always (since it is required by the HTTP spec) sends header lines
terminated with CRLF.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org