Am I using the proxy option in http_get correctly?

Using the “SWI-Prolog (threaded, 64 bits, version 9.2.9)”, I’m unsuccessfully using http_get with the proxy option. My actions:

use_module(library(http/http_open)).
use_module(library(http/http_client)).
% Each of the following, resulting in me timing out
URL='http://www.google.com', http_get(URL,_Data,[status_code(Code),final_url(Location), proxy('b3.hs:3132')]).

URL='http://www.google.com', http_get(URL,_Data,[status_code(Code),final_url(Location), proxy('10.0.5.14:3132')]).

A tcpdump reveals (from a separate window)
18:15:56.932081 IP 10.0.5.102.30932 > 172.217.24.36.80: Flags [S], seq 1346281332, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 208069181 ecr 0], length 0

Indicating that the proxy option isn’t being used, as the request is being sent directly to www.google.com (172.217.24.36) over port 80 rather than being proxied.

Am I incorrectly using http_get’s proxy option?

Aside http_get without using a proxy option to an internal web server

URL=‘http://10.0.5.14’, http_get(URL,_Data,[status_code(Code),final_url(Location)]).

was successful :slight_smile:

Platform details: FreeBSD 14.0 x64 with clang version 16.0.6.

Try using proxy('10.0.5.14':3132). The docs show the option is of the form proxy(host:port).

1 Like

Thanks Ian, I feel like such a goose. It doesn’t pay to be synchronising shell scripts, while thinking about python source and testing (what I wanted to be doing) threaded networking PROLOG.
Apologies for generating a silly and false “bug”, which lay with the author :}