我正在使用libcurl(http://curl.haxx.se/libcurl/)来触发HTTP请求。 我想在FQDN解析为IP地址后阻止对特定IP地址的请求。
我如何以及在哪里阻止特定IP地址的请求?
答案 0 :(得分:0)
使用getaddrinfo()
查找FQDN的IP地址。使用该地址来确定是否提交卷曲请求。
答案 1 :(得分:0)
libcurl itself has no block-this-IP-functionality built-in. But it does provide you with the building blocks for you to build your own!
Use CURLOPT_OPENSOCKETFUNCTION and have your callback do the address check, and return failure if the "bad" address is used and otherwise you call the normal socket() function.