ncr/rack-proxy — pull request #11 by ntalbott (2013-03-04 03:20:14+00:00)
Title: Treat header values as arrays

This fixes the case of multiple headers of the same name (set-cookie being the
real world example I ran into) getting all smooshed together into a single
(invalid) header. Net::HTTP tries to be smart and join such headers with a ",
", which isn't so bad when immediately consuming the results, but wreaks havoc
when passing those headers through the proxy.

Treating the header values as arrays fixes this issue, as Rack happily does
the right thing and passes back a separate header for each value it sees in
the array.

This definitely has the potential for breakage, as it implicitly changes the
header portion of the triplet passed to #rewrite_response.

I tried to figure out how to write a test for this and came up empty. Best bet
is probably to have your trix.pl endpoint return a double header and verify
that rack-proxy does the right thing with it.