changeset 65:cecf0cf46db3

Fixes to proxy handling.
author samer
date Tue, 09 Jun 2015 15:16:17 +0100
parents 0fff15c51019
children af73d604af57
files .swiplrc
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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
 	).
 
-