# HG changeset patch # User samer # Date 1433859377 -3600 # Node ID cecf0cf46db348a113b81c9ba70920bc03265cea # Parent 0fff15c5101927e31ac23e3f399b60349877a376 Fixes to proxy handling. diff -r 0fff15c51019 -r cecf0cf46db3 .swiplrc --- a/.swiplrc Wed May 20 17:00:04 2015 +0100 +++ b/.swiplrc Tue Jun 09 15:16:17 2015 +0100 @@ -23,31 +23,32 @@ sub_atom(Atom,_,LPost,0,Post). internal_host(localhost). -internal_host(Host) :- sub_atom(Host,_,_,0,'bl.uk'). +internal_host(Proxy) :- http_proxy(Proxy,_,_). +%internal_host(Host) :- sub_atom(Host,_,_,0,'bl.uk'). +% New scheme for proxy handling (>=7.3.0) +% :- multifile socket:proxy_for_url/3. +% socket:proxy_for_url(_, Target, proxy(Host,Port)) :- +% http_proxy(Host,Port,_), +% \+internal_host(Target), +% debug(proxy,'Using socketproxy ~w:~w for ~w',[Host,Port,Target]). + +% Old scheme, still required to provide authorisation details :- multifile http:open_options/2. -http:open_options(Parts,[proxy(Host:Port),proxy_authorization(Auth)|Opts]) :- +http:open_options(Parts,[proxy(Host:Port),proxy_authorization(Auth)]) :- http_proxy(Host,Port,Auth), option(host(Target),Parts), \+internal_host(Target), - debug(proxy,'Using HTTP proxy ~w:~w for ~w',[Host,Port,Target]), - debug(proxy,'Parts: ~w',[Parts]), - ( option(scheme(https),Parts) - -> debug(proxy,'Using HTTPS',[]), - Opts=[cert_verify_hook(verify_certificate)] - ; Opts=[] - ). - -verify_certificate(_,_,_,_,_) :- format(user_error,'Accepting certificate\n',[]). + debug(proxy,'Using HTTP proxy ~w:~w for ~w',[Host,Port,Target]). :- (colour_terminal -> load_files(library(ansi_term), [silent(true)]); true), set_prolog_flag(prompt_alternatives_on, determinism), set_prolog_flag(editor, '$EDITOR'), load_files(library(url), [silent(true)]), load_files(library(http/http_ssl_plugin), [silent(true)]), + retractall(http_proxy(_,_,_)), ( get_http_proxy(Host,Port,Auth) -> assert(http_proxy(Host,Port,Auth)) ; true ). -