From d20a3ea9b2e2ce9afebb627a04763dde77911794 Mon Sep 17 00:00:00 2001 From: "bcoles@gmail.com" Date: Tue, 8 Nov 2011 15:19:54 +0000 Subject: [PATCH] Fixes issue 533 : Tunneling proxy: bug when the hooked browser is IE Now checks for null HTTP header keys and values git-svn-id: https://beef.googlecode.com/svn/trunk@1424 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- extensions/proxy/handlers/zombie/handler.rb | 29 +++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/extensions/proxy/handlers/zombie/handler.rb b/extensions/proxy/handlers/zombie/handler.rb index 006a3b821..e78ae9666 100644 --- a/extensions/proxy/handlers/zombie/handler.rb +++ b/extensions/proxy/handlers/zombie/handler.rb @@ -96,17 +96,24 @@ module Zombie if(res.status != -1 && res.status != 0) headers.each_line do |line| # stripping the Encoding, Cache and other headers - if line.split(': ')[0] != "Content-Encoding" && - line.split(': ')[0] != "Content-Length" && - line.split(': ')[0] != "Keep-Alive" && - line.split(': ')[0] != "Cache-Control" && - line.split(': ')[0] != "Vary" && - line.split(': ')[0] != "Pragma" && - line.split(': ')[0] != "Connection" && - line.split(': ')[0] != "Expires" && - line.split(': ')[0] != "Accept-Ranges" && - line.split(': ')[0] != "Date" - headers_hash[line.split(': ')[0]] = line.split(': ')[1].gsub!(/[\n]+/,"") + header_key = line.split(': ')[0] + header_value = line.split(': ')[1] + if !header_key.nil? && + header_key != "Content-Encoding" && + header_key != "Content-Length" && + header_key != "Keep-Alive" && + header_key != "Cache-Control" && + header_key != "Vary" && + header_key != "Pragma" && + header_key != "Connection" && + header_key != "Expires" && + header_key != "Accept-Ranges" && + header_key != "Date" + if header_value.nil? + #headers_hash[header_key] = "" + else + headers_hash[header_key] = header_value.gsub!(/[\n]+/,"") + end end end