fix a response header parsing crash bug
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sat, 17 Aug 2013 19:32:49 +0000 (13:32 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sat, 17 Aug 2013 19:38:01 +0000 (13:38 -0600)
Thank you @Getty for reporting.

lib/Plack/App/Proxy/WebSocket.pm

index acbcdbc51c428513ad5b7a1686a6e78b984512bb..25f5a15c257065471b8c55994014d18f57451589 100644 (file)
@@ -8,7 +8,7 @@ use AnyEvent::Handle;
 use AnyEvent::Socket;
 use HTTP::Headers;
 use HTTP::Request;
-use HTTP::Parser::XS qw/parse_http_response HEADERS_AS_ARRAYREF/;
+use HTTP::Parser::XS qw/parse_http_response HEADERS_AS_HASHREF/;
 use Plack::Request;
 use URI;
 
@@ -121,11 +121,11 @@ sub call {
                 $buffer .= $buf;
 
                 my ($ret, $http_version, $status, $message, $headers) =
-                    parse_http_response($buffer, HEADERS_AS_ARRAYREF);
+                    parse_http_response($buffer, HEADERS_AS_HASHREF);
                 $server->push_shutdown if $ret == -2;
                 return if $ret < 0;
 
-                $headers = [$self->response_headers($headers)] unless $status == 101;
+                $headers = [$self->response_headers(HTTP::Headers->new(%$headers))] unless $status == 101;
                 $writer = $res->([$status, $headers]);
                 $writer->write(substr($buffer, $ret));
                 $buffer = undef;
This page took 0.023736 seconds and 4 git commands to generate.