rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* CommonLogger (and Clogger) generates strange symbols in the response body
@ 2009-09-03 23:02 Iñaki Baz Castillo
  2009-09-03 23:28 ` Iñaki Baz Castillo
  2009-09-04  1:35 ` Eric Wong
  0 siblings, 2 replies; 8+ messages in thread
From: Iñaki Baz Castillo @ 2009-09-03 23:02 UTC (permalink / raw)
  To: rack-devel


Hi, I can't understand why the following issue occurs in the response body 
when using CommonLogger:


----- app_logic.rb -----
class AppLogic
  def call(env)
    200, {"Content-Type" => "text/plain"}, "line1\nline2\nline3\n"
  end
end
------------------------


------- run_server.rb ------
require "app_logic.rb"
rack_inner_app = AppLogic.new

rack_app = Rack::Builder.new {
  use Rack::CommonLogger, $stderr
  run rack_inner_app
}.to_app

Rack::Handler::Thin.run rack_app
----------------------------



The reply I get in the 200 OK response is as follows:

-------------
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/plain
Server: OpenXDMS
Connection: close

6
line1

6
line2

6
line3

0

-------------

As you can see, the number above each real body line is the length of the line 
below it (in hexadecimal when > 10).


If I comment the CommonLogger line, then I get the correct body:

--------------
line1
line2
line3
--------------



It occurs the same if I log to a file and also if I use Clogger instead of 
CommonLogger.

Is there something wrong in my code? is it the expected behaviour? (I cannot 
figure it of course as it breaks the response).


Thanks a lot.



-- 
Iñaki Baz Castillo <ibc@aliax.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-09-04 20:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 23:02 CommonLogger (and Clogger) generates strange symbols in the response body Iñaki Baz Castillo
2009-09-03 23:28 ` Iñaki Baz Castillo
2009-09-04  1:35 ` Eric Wong
2009-09-04 13:47   ` Iñaki Baz Castillo
2009-09-04 19:13     ` Eric Wong
2009-09-04 19:20       ` Iñaki Baz Castillo
2009-09-04 19:42         ` Eric Wong
2009-09-04 19:44           ` Iñaki Baz Castillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).