2017-10-13 9 views
0

프록시 데이터를 제공하는 사용하지 않습니다AsyncHttpClient 내가 그것의 중심에 외부 URL에서 정보를 수집하기 위해이 블록을 사용하는 쿼리 도구를 작성했습니다

AsyncHttpClientConfig proxiedCF = new DefaultAsyncHttpClientConfig.Builder().setUserAgent(pickUserAgent()).build(); 
AsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient(proxiedCF); 
Future<Response> f = asyncHttpClient.prepareGet(url).setProxyServer(new ProxyServer.Builder(pickProxyServer(), 80)).execute(); 

그것은 잘 작동합니다. 그러나 그것은 잘못된 프록시가 제공 될 때조차도 약간의 의심 스럽지만 정교한 프록시 구성이 전혀 사용되지 않는다고 느낍니다.

pickProxyServer()가 올바른 웹 프록시가 아닌 "1.1.1.1"문자열을 반환함으로써이 문제가 발생했습니다.

나는 로깅을위한 SLF4J를 사용하고 꽤 정상 같습니다

20:31:47.454 [AsyncHttpClient-7-1] DEBUG o.a.n.channel.NettyConnectListener - Using new Channel '[id: 0x03359938, L:/10.0.0.101:59775 - R:/1.1.1.1:80]' for 'GET' to '[[url removed by me]]' 
20:31:47.586 [AsyncHttpClient-7-1] DEBUG o.a.netty.handler.HttpHandler - 

Request DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE) 
GET [[url removed by me]] HTTP/1.1 
Host: [[url removed by me]] 
Accept: */* 
User-Agent: burning_dandelion 

Response DefaultHttpResponse(decodeResult: success, version: HTTP/1.1) 
HTTP/1.1 200 OK 
Date: Fri, 13 Oct 2017 18:31:49 GMT 
Expires: Fri, 13 Oct 2017 18:31:49 GMT 
Cache-Control: private, max-age=3600 
Content-Type: text/xml; charset=ISO-8859-1 
P3P: CP="This is not a P3P policy!" 
Server: gws 
X-XSS-Protection: 1; mode=block 
X-Frame-Options: SAMEORIGIN 
Set-Cookie: 1P_JAR=2017-10-13-18; expires=Fri, 20-Oct-2017 18:31:49 GMT; path=/; domain=[[url removed by me]] 
Set-Cookie: NID=114=qiVBv02cmXYHh2RfLQbhBfESWIoaGlf3d2jlSbAdQ8yWPDsCpOeK9aYbvfq0HWsER68W1oE53jiriM_fivTc1bJi1F2sfCi0wMptKI-9U3ueVKITtFvYYZx2T0rJf1kQ; expires=Sat, 14-Apr-2018 18:31:49 GMT; path=/; domain=[[url removed by me]]; HttpOnly 
Accept-Ranges: none 
Vary: Accept-Encoding 
Transfer-Encoding: chunked 

20:31:47.587 [AsyncHttpClient-7-1] DEBUG o.a.netty.channel.ChannelManager - Adding key: ProxyPartitionKey(proxyHost=1.1.1.1, proxyPort=80, secured=false, targetHostBaseUrl=[[url removed by me]]:80 for channel [id: 0x03359938, L:/10.0.0.101:59775 - R:/1.1.1.1:80] 

누군가가 내 오류를 향해 날 지점 수 있습니까? 분명히 잘못된 프록시를 요청할 때 I/O 예외 또는 모든 종류의 통지가 필요합니다.

답변

0

좋아, 한밤중에 있지만 뭔가를 발견했습니다. 포트가 : 80이면 프록시가 올바르게 사용됩니다. 이것은 나를위한 트릭을 않습니다.