From 037a08a1536d8202293cbcb920cc8d55defb8be1 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 17 Aug 2013 13:32:49 -0600 Subject: [PATCH] fix a response header parsing crash bug Thank you @Getty for reporting. --- lib/Plack/App/Proxy/WebSocket.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Plack/App/Proxy/WebSocket.pm b/lib/Plack/App/Proxy/WebSocket.pm index acbcdbc..25f5a15 100644 --- a/lib/Plack/App/Proxy/WebSocket.pm +++ b/lib/Plack/App/Proxy/WebSocket.pm @@ -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; -- 2.45.2