Skip to content

Commit

Permalink
Remove is_local_https predicate
Browse files Browse the repository at this point in the history
Is not needed anymore since we switched off local https
  • Loading branch information
rrooij committed Jul 20, 2021
1 parent 13893ac commit 79e2339
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
6 changes: 1 addition & 5 deletions src/core/api/db_fetch.pl
Expand Up @@ -67,10 +67,6 @@
-> Document = _{ repository_head: Repository_Head }
; Document = _{}),

( is_local_https(URL)
-> Additional_Options = [cert_verify_hook(cert_accept_any)]
; Additional_Options = []),

remote_pack_url(URL,Pack_URL),

http_post(Pack_URL,
Expand All @@ -79,7 +75,7 @@
[request_header('Authorization'=Authorization),
json_object(dict),
status_code(Status)
|Additional_Options]),
]),

( Status = 200
-> Payload_Option = some(Payload)
Expand Down
7 changes: 1 addition & 6 deletions src/core/api/db_push.pl
Expand Up @@ -153,11 +153,6 @@

% NOTE: What do we do with the remote branch? How do we send it?
authorized_push(Authorization, Remote_URL, Payload) :-

( is_local_https(Remote_URL)
-> Additional_Options = [cert_verify_hook(cert_accept_any)]
; Additional_Options = []),

catch(
( % Try TUS protocol (we could check resulting options too for create etc...)
remote_tus_url(Remote_URL, TUS_URL),
Expand Down Expand Up @@ -188,7 +183,7 @@
json_object(dict),
timeout(infinite),
status_code(Status_Code)
|Additional_Options]),
]),
E,
throw(error(communication_failure(E),_))),

Expand Down
4 changes: 1 addition & 3 deletions src/core/util.pl
Expand Up @@ -186,9 +186,7 @@
benchmark/0,

% http_utils.pl
basic_authorization/3,
is_local_https/1

basic_authorization/3
]).

% note: test_utils is intentionally omitted
Expand Down
6 changes: 1 addition & 5 deletions src/core/util/http_utils.pl
@@ -1,12 +1,8 @@
:- module(http_utils,[
basic_authorization/3,
is_local_https/1
basic_authorization/3
]).

basic_authorization(User,Pass,Authorization) :-
format(string(S), "~s:~s", [User, Pass]),
base64(S, Base64_Destination_Auth),
format(string(Authorization), "Basic ~s", [Base64_Destination_Auth]).

is_local_https(URL) :-
re_match('^https://127.0.0.1', URL, []).

0 comments on commit 79e2339

Please sign in to comment.