I guess I should have waited a bit longer to send that email, I think I've tracked it down.
When one of the values in @headers contains an empty list we get a
superfluous CRLF, ie:
>> Z = "\r\n"
>> headers = {"Content-Type"=>"text/plain;charset=utf-8", "Set-Cookie"=>[]}
>> headers.map{|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z # the relevant part of
>> Base#to_s
=> "Content-Type: text/plain;charset=utf-8\r\n\r\n"
...
>> headers["Set-Cookie"] = "something"
>> headers.map{|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z
=> "Content-Type: text/plain;charset=utf-8\r\nSet-Cookie: something\r\n"
If no cookies have been set, @headers["Set-Cookie"] = [] and you get the
correct number of CRLFs; otherwise, you're short one. I'll leave it to
the golfing pros to figure out the best fix for that.
Unfortunately this brings another, unrelated problem to my attention;
apparently I'm getting "0x1df\r\n" inserted between my headers and my
body. Only on FastCGI, and only with Camping. Maybe it's time to move
from FastCGI :(.
pgpCsRGawMLoR.pgp
Description: PGP signature
_______________________________________________ Camping-list mailing list [email protected] http://rubyforge.org/mailman/listinfo/camping-list

