From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.86.23.1 with SMTP id 1cs107806fgw; Thu, 3 Sep 2009 16:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.101.162.13 as permitted sender) client-ip=10.101.162.13; Authentication-Results: mr.google.com; spf=pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.101.162.13 as permitted sender) smtp.mail=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com; dkim=pass header.i=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com Received: from mr.google.com ([10.101.162.13]) by 10.101.162.13 with SMTP id p13mr521977ano.22.1252020500757 (num_hops = 1); Thu, 03 Sep 2009 16:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received:received-spf:received:received:received :from:to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=C1vrxzviHSJHLgDH0gSBIG9v3I2DdxqjPKBYAhCUbQ4=; b=6TCQq5qQOFe2zcxdZT+QV+AsLYqm4NlXyQ+fnJZD3fx5IvHb9JbvJ1+lPG3gNonqzV jwpOmgNQOR242CkvF3x9WLFw3LUmbBZOaP2t2F/WlLZNw0WfwSgK6wD7+khIoXN1ub5G RjWVwjAoS31PI5vJiXRqU+zpUustVVuZISv7I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:from :to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=cx3u4pn8114oa1GgbmtDlnvuoiVH85A4juMmVulp2qPV3EgBhpr9znA5u5GIi6W8kZ flDCxDrs7B92my+CFxJItX9u7Rk8BuZXsFAtxR6vu/yvYCkW+LPNUau92EYtf1OBd+Mk AGcsomEVeSsuJ0Mihv/laMqGA2luOWzCeJ3zc= Received: by 10.101.162.13 with SMTP id p13mr64187ano.22.1252020500667; Thu, 03 Sep 2009 16:28:20 -0700 (PDT) Received: by 10.176.13.37 with SMTP id 37gr1632yqm.0; Thu, 03 Sep 2009 16:28:10 -0700 (PDT) X-Sender: ibc@aliax.net X-Apparently-To: rack-devel@googlegroups.com Received: by 10.204.10.131 with SMTP id p3mr411634bkp.14.1252020489187; Thu, 03 Sep 2009 16:28:09 -0700 (PDT) Received: by 10.204.10.131 with SMTP id p3mr411633bkp.14.1252020489164; Thu, 03 Sep 2009 16:28:09 -0700 (PDT) Return-Path: Received: from mail-bw0-f224.google.com (mail-bw0-f224.google.com [209.85.218.224]) by gmr-mx.google.com with ESMTP id 16si48199fxm.2.2009.09.03.16.28.09; Thu, 03 Sep 2009 16:28:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.218.224 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) client-ip=209.85.218.224; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.218.224 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) smtp.mail=ibc@aliax.net Received: by bwz24 with SMTP id 24so320136bwz.38 for ; Thu, 03 Sep 2009 16:28:09 -0700 (PDT) Received: by 10.103.86.38 with SMTP id o38mr4446654mul.114.1252020488531; Thu, 03 Sep 2009 16:28:08 -0700 (PDT) Return-Path: Received: from ibc-laptop.localnet (1.217.218.87.dynamic.jazztel.es [87.218.217.1]) by mx.google.com with ESMTPS id j6sm572724mue.0.2009.09.03.16.28.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Sep 2009 16:28:07 -0700 (PDT) From: =?utf-8?q?I=C3=B1aki_Baz_Castillo?= To: rack-devel@googlegroups.com Subject: Re: CommonLogger (and Clogger) generates strange symbols in the response body Date: Fri, 4 Sep 2009 01:28:05 +0200 User-Agent: KMail/1.12.1 (Linux/2.6.28-15-generic; KDE/4.3.1; x86_64; ; ) References: <200909040102.14378.ibc@aliax.net> In-Reply-To: <200909040102.14378.ibc@aliax.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <200909040128.05580.ibc@aliax.net> Reply-To: rack-devel@googlegroups.com Sender: rack-devel@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rack-devel@googlegroups.com; contact rack-devel+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rack-devel@googlegroups.com X-BeenThere: rack-devel@googlegroups.com El Viernes, 4 de Septiembre de 2009, I=C3=B1aki Baz Castillo escribi=C3=B3: > Hi, I can't understand why the following issue occurs in the response body > when using CommonLogger: >=20 >=20 > ----- app_logic.rb ----- > class AppLogic > def call(env) > 200, {"Content-Type" =3D> "text/plain"}, "line1\nline2\nline3\n" > end > end > ------------------------ >=20 >=20 > ------- run_server.rb ------ > require "app_logic.rb" > rack_inner_app =3D AppLogic.new >=20 > rack_app =3D Rack::Builder.new { > use Rack::CommonLogger, $stderr > run rack_inner_app > }.to_app >=20 > Rack::Handler::Thin.run rack_app > ---------------------------- >=20 >=20 >=20 > The reply I get in the 200 OK response is as follows: >=20 > ------------- > HTTP/1.1 200 OK > Transfer-Encoding: chunked > Content-Type: text/plain > Server: OpenXDMS > Connection: close >=20 > 6 > line1 >=20 > 6 > line2 >=20 > 6 > line3 >=20 > 0 >=20 > ------------- >=20 > As you can see, the number above each real body line is the length of the > line below it (in hexadecimal when > 10). >=20 >=20 > If I comment the CommonLogger line, then I get the correct body: >=20 > -------------- > line1 > line2 > line3 > -------------- >=20 >=20 >=20 > It occurs the same if I log to a file and also if I use Clogger instead of > CommonLogger. >=20 > Is there something wrong in my code? is it the expected behaviour? (I > cannot figure it of course as it breaks the response). It's not an error in my code as a simpler example also issues this problem: =2D----simple_rack.rb-------- require 'rubygems' require 'rack' infinity =3D Proc.new {|env| [200, {"Content-Type" =3D> "text/html"}, "hell= o"]} builder =3D Rack::Builder.new do use Rack::CommonLogger run infinity end Rack::Handler::Mongrel.run builder, :Port =3D> 9292 =2D-------------------------- ~# ruby1.8 simple_rack.rb And this is the response: =2D-------------------------- HTTP/1.1 200 OK Connection: close Date: Thu, 03 Sep 2009 23:24:39 GMT Transfer-Encoding: chunked Content-Type: text/html 4 hello 0 =2D-------------------------- Without the CommonLogger middleware, the response body is correct: =2D--------- hello =2D--------- =C2=BF?=C2=BF? =2D-=20 I=C3=B1aki Baz Castillo