Archived Forum PostQuestion:
Hi
I am using chilkat v9.5.0.51 Mono on Mac, Xamarin iOS & Android. After setting preferIpv6 to true on my Http object, some servers fail to be requested, for instance:
http://nominatim.openstreetmap.org/search?q=sabah&format=xml&limit=20
If preferIpv6 is false, these requests work fine. Is it a server issue? Can I fix it on the client side?
Thanks Guillaume
Updating to Chilkat v9.5.0.58 should fix the problem. I just tested it, and it worked fine.
Make sure your ISP supports IPv6. Also make sure your computer is capable of using IPv6. For me, my normal work environment does not have IPv6 capability, which means to test I must run on some remote server (web hosting account, etc.).
If I run on my local computer where IPv6 is not possible, then I see only IPv4 addresses w/ verbose logging turned on, and therefore the connection happens over IPv4 even if PreferIpv6 is true.
If I run on a web server where IPv6 is possible, then everything works (for me). For example, I just tested the following Perl script:
use lib qw(./chilkat/myPerl/share/perl5/); use chilkat();The LastErrorText shows the IPv6 address and that it was used for the connection:$http = new chilkat::CkHttp();
# Any string unlocks the component for the 1st 30-days. $success = $http->UnlockComponent("Anything for 30-day trial"); if ($success != 1) { print $http->lastErrorText() . "\r\n"; exit; }
$http->put_VerboseLogging(1);
$http->put_PreferIpv6(1);
$response = $http->quickGetStr("http://nominatim.openstreetmap.org/search?q=sabah&format=xml&limit=20"); if ($http->get_LastMethodSuccess() != 1) { print $http->lastErrorText() . "\r\n"; exit; }
print $response . "\r\n"; print $http->lastErrorText() . "\r\n";
ChilkatLog:
QuickGetStr(271ms):
DllDate: Oct 7 2016
ChilkatVersion: 9.5.0.61
UnlockPrefix: Anything for 30-day trial
Architecture: Little Endian; 64-bit
Language: Linux Perl
VerboseLogging: 1
url: http://nominatim.openstreetmap.org/search?q=sabah&format=xml&limit=20
httpRequestStr(271ms):
a_quickReq(271ms):
quickHttpRequest(271ms):
httpVerb: GET
url: http://nominatim.openstreetmap.org/search?q=sabah&format=xml&limit=20
openHttpConnection(110ms):
Opening connection directly to HTTP server.
httpHostname: nominatim.openstreetmap.org
httpPort: 80
ssl: 0
bUsingHttpProxy: 0
httpProxyAuthMethod:
socket2Connect(110ms):
connect2(110ms):
hostname: nominatim.openstreetmap.org
port: 80
ssl: 0
connectSocket(110ms):
domainOrIpAddress: nominatim.openstreetmap.org
port: 80
connectTimeoutMs: 30000
connect_ipv6_or_ipv4(110ms):
Single-threaded domain to IP address resolution
The application prefers IPv6 over IPv4. Looking for IPv6 addresses first...
connecting to IPV6 address...
ipAddress: 2001:630:12:500:ec4:7aff:fe66:96d2
createSocket:
Setting SO_SNDBUF size
sendBufSize: 262144
Setting SO_RCVBUF size
recvBufSize: 4194304
--createSocket
connect(110ms):
Waiting for the connect to complete...
myIP: 2607:f0d0:1103:106:22::12c
myPort: 36184
socket connect successful.
--connect
--connect_ipv6_or_ipv4
--connectSocket
--connect2
--socket2Connect
socketOptions:
SO_SNDBUF: 249856
SO_RCVBUF: 249856
TCP_NODELAY: 0
SO_KEEPALIVE: 1
--socketOptions
HTTP connection succeeded.
--openHttpConnection
buildQuickRequest:
genStartLine:
Adding params to the start line...
startLine: GET /search?q=sabah&format=xml&limit=20 HTTP/1.1
--genStartLine
getMimeHeaderHttp:
headerField: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
headerField: Connection: keep-alive
headerField: User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
headerField: Accept-Language: en-us,en;q=0.5
--getMimeHeaderHttp
addCookies:
Not auto-adding cookies.
sendCookies: 1
cookieDir:
--addCookies
--buildQuickRequest
quickRequestHeader:
requestHeader: GET /search?q=sabah&format=xml&limit=20 HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip
Host: nominatim.openstreetmap.org
--quickRequestHeader
sendRequestHeader:
sendHeaderElapsedMs: 0
--sendRequestHeader
readResponseHeader(161ms):
responseHeader: HTTP/1.1 200 OK
Date: Fri, 07 Oct 2016 23:06:46 GMT
Server: Apache/2.4.18 (Ubuntu)
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS,GET
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1544
Connection: close
Content-Type: text/xml; charset=UTF-8
--readResponseHeader
statusCode: 200
statusText: OK
readResponseBody:
bDiscard: 0
contentLength: 1544
numBytesToReceive: 1544
--readResponseBody
checkCloseConnection:
Response includes connection:close header (or proxy-connection:close header)
cleanCloseHttpConnection:
terminateConnection:
TCP connection cleanly closed by peer.
Cleanly terminated TCP connection.
--terminateConnection
--cleanCloseHttpConnection
--checkCloseConnection
--quickHttpRequest
checkUngzipResponse:
decompressing GZIP response...
--checkUngzipResponse
--a_quickReq
convertResponseBodyToUtf8:
responseBodySize: 4458
Logging up to 2048 bytes of the response in quoted-printable format:
responseQP: [<?xml version=3D"1.0" encoding=3D"UTF-8" ?>=0A<searchresults timestamp=3D'Fri, 07 Oct 16 23:06:46 +0000' attribution=3D'Data =C2=A9 OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright' querystring=3D'sabah' polygon=3D'false' exclude_place_ids=3D'159718645,26212864,25973053,12738836,12751453,24999386,55659910,124182295,124182291,18302792,25739459,143459436' more_url=3D'http://nominatim.openstreetmap.org/search.php?format=3Dxml&exclude_place_ids=3D159718645,26212864,25973053,12738836,12751453,24999386,55659910,124182295,124182291,18302792,25739459,143459436&accept-language=3Den-us,en;q=3D0.5&q=3Dsabah'>=0A<place place_id=3D'159718645' osm_type=3D'relation' osm_id=3D'3879783' place_rank=3D'8' boundingbox=3D"4.0969619,7.5111989,115.32751,119.4390876" lat=3D'5.595237' lon=3D'117.0051734' display_name=3D'Sabah, Malaysia' class=3D'boundary' type=3D'administrative' importance=3D'0.699443639274' icon=3D'http://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png'/><place place_id=3D'26212864' osm_type=3D'node' osm_id=3D'2489253500' place_rank=3D'19' boundingbox=3D"35.289185,35.329185,43.348372,43.388372" lat=3D'35.309185' lon=3D'43.368372' display_name=3D'Sabah, Saladin, Iraq' class=3D'place' type=3D'village' importance=3D'0.375' icon=3D'http://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png'/><place place_id=3D'25973053' osm_type=3D'node' osm_id=3D'2487904956' place_rank=3D'19' boundingbox=3D"30.949167,30.989167,47.121389,47.161389" lat=3D'30.969167' lon=3D'47.141389' display_name=3D'Sabah, Basra, Iraq' class=3D'place' type=3D'village' importance=3D'0.375' icon=3D'http://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png'/><place place_id=3D'12738836' osm_type=3D'node' osm_id=3D'1223194777' place_rank=3D'19' boundingbox=3D"14.053781,14.093781,45.4263958,45.4663958" lat=3D'14.073781' lon=3D'45.4463958' display_name=3D'Sabah, Al Bayda' Governorate, Yemen' class=3D'place' type=3D'village' importance=3D'0.375' ic=
on=3D'http://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png'/><place place_id="3D'12751453'" osm_type="3D'node'" os]="" responsecontenttype:="" text="" xml;="" charset="UTF-8" responsehdrcharset:="" utf-8="" --convertresponsebodytoutf8="" --httprequeststr="" success.="" --quickgetstr="" --chilkatlog="" <="" pre="">