Skip to content
This repository
Browse code

Fix multi headers handling

  • Loading branch information...
commit 3278802815048cff42b01ca2b929bc1db07041d4 1 parent 294fb85
Jonathan Steinert authored

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. +7 1 lib/Perlbal/Plugin/PSGI.pm
8 lib/Perlbal/Plugin/PSGI.pm
@@ -166,8 +166,14 @@ sub run_request {
166 166 my $res = shift;
167 167
168 168 my $hd = $pb->{res_headers} = Perlbal::HTTPHeaders->new_response($res->[0]);
  169 + my %seen;
169 170 while (my($k, $v) = splice @{$res->[1]}, 0, 2) {
170   - $hd->header($k, $v);
  171 + if ($seen{lc($k)}++) {
  172 + my $newvalue = $hd->header($k) . "\015\012$k: $v";
  173 + $hd->header($k, $newvalue);
  174 + } else {
  175 + $hd->header($k, $v);
  176 + }
171 177 }
172 178
173 179 $pb->setup_keepalive($hd);

0 comments on commit 3278802

Please sign in to comment.
Something went wrong with that request. Please try again.