File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ Billy.configure do |c|
294294 c.non_whitelisted_requests_disabled = false
295295 c.cache_path = ' spec/req_cache/'
296296 c.certs_path = ' spec/req_certs/'
297- c.proxy_host = ' example.com' # defaults to localhost
297+ c.proxy_host = ' example.com' # defaults to 127.0.0.1
298298 c.proxy_port = 12345 # defaults to random
299299 c.proxied_request_host = nil
300300 c.proxied_request_port = 80
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def reset
3939 @non_whitelisted_requests_disabled = false
4040 @cache_path = File . join ( Dir . tmpdir , 'puffing-billy' )
4141 @certs_path = File . join ( Dir . tmpdir , 'puffing-billy' , 'certs' )
42- @proxy_host = 'localhost '
42+ @proxy_host = '127.0.0.1 '
4343 @proxy_port = RANDOM_AVAILABLE_PORT
4444 @proxied_request_inactivity_timeout = 10 # defaults from https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts
4545 @proxied_request_connect_timeout = 5
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def initialize
2020 def start ( threaded = true )
2121 if threaded
2222 Thread . new { main_loop }
23- sleep ( 0.01 ) while !defined? ( @signature ) || @signature . nil?
23+ sleep ( 0.01 ) while !defined? ( @port ) || @port . nil?
2424 else
2525 main_loop
2626 end
@@ -43,7 +43,7 @@ def host
4343 end
4444
4545 def port
46- Socket . unpack_sockaddr_in ( EM . get_sockname ( @signature ) ) . first
46+ @port
4747 end
4848
4949 def cache
@@ -84,6 +84,8 @@ def main_loop
8484 end
8585 end
8686
87+ @port = Socket . unpack_sockaddr_in ( EM . get_sockname ( @signature ) ) . first
88+
8789 Billy . log ( :info , "puffing-billy: Proxy listening on #{ url } " )
8890 end
8991 end
You can’t perform that action at this time.
0 commit comments