From b9f53c8f96e248d1aa3bb737588d75bcb44d775f Mon Sep 17 00:00:00 2001 From: "scotty.b.brown@gmail.com" Date: Thu, 26 May 2011 06:46:19 +0000 Subject: [PATCH] More tweaking to proxy to help it work with browsers (and not just telnet :p) git-svn-id: https://beef.googlecode.com/svn/trunk@986 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- extensions/proxy/handlers/zombie/handler.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extensions/proxy/handlers/zombie/handler.rb b/extensions/proxy/handlers/zombie/handler.rb index 78bb99a7d..28010e7e5 100644 --- a/extensions/proxy/handlers/zombie/handler.rb +++ b/extensions/proxy/handlers/zombie/handler.rb @@ -13,7 +13,7 @@ module Zombie # will be sent back to use def forward_request(hooked_browser_id, req, res) - # Generate a id for the req in the http table and check it doesnt already exist + # Generate an id for the req in the http table and check it doesnt already exist http_id = rand(10000) http_db = H.first(:id => http_id) || nil @@ -22,19 +22,26 @@ module Zombie http_db = H.first(:id => http_id) || nil end + # Append port to domain string if not 80 or 443 + if req.port != 80 or req.port != 443 + domain = req.host.to_s + ':' + req.port.to_s + else + domain = req.host.to_s + end + # Saves the new HTTP request to the db for processing by browser http = H.new( :id => http_id, :request => req, :method => req.request_method.to_s, - :domain => req.host.to_s, + :domain => domain, :path => req.path.to_s, :date => Time.now, :hooked_browser_id => hooked_browser_id ) http.save - print_debug "[PROXY] Request #" + http_id.to_s + " to " + req.host.to_s + req.path.to_s + " added to queue for browser id #" + hooked_browser_id.to_s + print_debug "[PROXY] Request #" + http_id.to_s + " to " + domain + req.path.to_s + " added to queue for browser id #" + hooked_browser_id.to_s # Polls the DB for the response and then sets it when present http_db = H.first(:id => http_id)