When I visit this site http://ifconfig.me/ip using the web browser I
get the expected text output. However if I try to do it from Pharo 6.1
(Windows 8.1) I get a 403 forbidden response using this code:

ZnClient new
    systemPolicy;
    beOneShot;
    accept: ZnMimeType textPlain;
    timeout: 6000;
    url: 'http://ifconfig.me/ip';
    get.

2018-09-16 03:06:18 011 Retrying ConnectionTimedOut: Cannot connect to
153.121.72.212:80
2018-09-16 03:06:19 012 Connection Established ifconfig.me:80
153.121.72.212 288ms
2018-09-16 03:06:19 013 Request Written a ZnRequest(GET /all.xml) 1ms
2018-09-16 03:06:19 014 Response Read a ZnResponse(403 Forbidden
text/html;charset=iso-8859-1 209B) 318ms
2018-09-16 03:06:19 015 GET /all.xml 403 209B 319ms
2018-09-16 03:06:19 016 Connection Closed 153.121.72.212:80

In Firefox this is the output

Request Headers Firefox:

Host: ifconfig.me
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:62.0)
Gecko/20100101 Firefox/62.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1

Response Headers Firefox:

HTTP/1.1 200 OK
Date: Sun, 16 Sep 2018 16:47:02 GMT
Server: Apache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 32
Connection: close
Content-Type: text/plain


Any idea?

Cheers,

Hernán

Reply via email to