你好,我想知道为什么webview.loadUrl(url,additionalHttpHeaders)这种方式不能达到ip直连的效果
CPT-CJS opened this issue · 0 comments
CPT-CJS commented
代码如下
Map<String, String> extraHeaders = new HashMap<String, String>();
extraHeaders.put("Referer", "");
extraHeaders.put("Host", host);
String ip = HttpDNS.getIpByHostAsync(host);
if (!TextUtils.isEmpty(ip)) {
String newUrl = StringRegular.urlWithIp(currentUrl, ip);
view.loadUrl(newUrl, extraHeaders);
}
跟了一波webview源码没找到原因,功力不够,求解