2013-07-23 2 views
8

여기에 어떤 문제가 있는지 확실하지 않습니다.TOR을 통한 Polipo를 통한 치료로 https 사이트에 연결하는 방법은 무엇입니까?

나는 내가 TOR를 통해 요청을 보낼 수 있습니다 내 로컬 Privoxy를 프록시 연결 테스트하기 위해 매우 간단한 Scrapy 거미를 만든 파이썬 2.7.3, 및 Scrapy 0.16.5

을 실행합니다. 다음과 같이 내 거미의 기본 코드는 다음과 같습니다 내 프록시 미들웨어

from scrapy.spider import BaseSpider 

class TorSpider(BaseSpider): 
    name = "tor" 
    allowed_domains = ["check.torproject.org"] 
    start_urls = [ 
     "https://check.torproject.org" 
    ] 

    def parse(self, response): 
     print response.body 

이, 내가 정의한 : 내 설정 파일에

class ProxyMiddleware(object): 
    def process_request(self, request, spider): 
     request.meta['proxy'] = settings.get('HTTP_PROXY') 

내 HTTP_PROXY는 HTTP_PROXY = 'http://localhost:8123'으로 정의된다.

이제 시작 URL을 http://check.torproject.org으로 변경하면 모든 것이 문제없이 작동합니다. (: // 사이트, 그들 모두는 같은 문제가 나는 또한 다른 HTTPS를 시도했습니다) : 나는 https://check.torproject.org에 대해 실행하려고하면

, 나는 400 잘못된 요청 오류마다 얻을

2013-07-23 21:36:18+0100 [scrapy] INFO: Scrapy 0.16.5 started (bot: arachnid) 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, RandomUserAgentMiddleware, ProxyMiddleware, RetryMiddleware, DefaultHeadersMiddleware, RedirectMiddleware, CookiesMiddleware, HttpCompressionMiddleware, ChunkedTransferMiddleware, DownloaderStats 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Enabled item pipelines: 
2013-07-23 21:36:18+0100 [tor] INFO: Spider opened 
2013-07-23 21:36:18+0100 [tor] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min) 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Telnet console listening on 0.0.0.0:6023 
2013-07-23 21:36:18+0100 [scrapy] DEBUG: Web service listening on 0.0.0.0:6080 
2013-07-23 21:36:18+0100 [tor] DEBUG: Retrying <GET https://check.torproject.org> (failed 1 times): 400 Bad Request 
2013-07-23 21:36:18+0100 [tor] DEBUG: Retrying <GET https://check.torproject.org> (failed 2 times): 400 Bad Request 
2013-07-23 21:36:18+0100 [tor] DEBUG: Gave up retrying <GET https://check.torproject.org> (failed 3 times): 400 Bad Request 
2013-07-23 21:36:18+0100 [tor] DEBUG: Crawled (400) <GET https://check.torproject.org> (referer: None) 
2013-07-23 21:36:18+0100 [tor] INFO: Closing spider (finished) 

그냥 내 TOR/Polipo 설정에 문제가 없다는 것을 다시 한번 확인하면 터미널에서 다음 말풍선 명령을 실행하고 잘 연결할 수 있습니다. curl --proxy localhost:8123 https://check.torproject.org/

무엇이 잘못 되었습니까? 이리?

+0

https_proxy가 무엇으로 설정되어 있습니까? HTTP 및 HTTPS는 일반적으로 다른 포트 등을 통해 전송되므로 다른 프록시가 필요합니다. – Andenthal

+0

내가 잘 모르겠다. 확실하게 HTTP 프록시에 연결하면 HTTPS URL에 연결되므로 제대로 작동해야합니까? 왜 HTTPS URL에 연결하려면 HTTPS 프록시에 연결해야합니까? 그러한 경우 위의 cURL 명령이 실패하지 않습니까? –

답변

0
+4

링크에는 답변이 포함되어 있지만 StackOverflow의 목표 중 하나는 추가 파싱이 중단되거나 필요할 수있는 링크뿐만 아니라 문제에 대한 실제 솔루션을 카탈로그 화하고 구성하는 것입니다. 답변에서 관련 부분을 요약하고 링크를 참조로 사용할 수 있다면 답변을 더 받아 들일 수 있습니다. 자세한 지침은 [이 페이지] (http://stackoverflow.com/questions/how-to-answer)를 참조하십시오. – beroe

0

는 작품의 내 경우

rq.meta['proxy'] = 'http://127.0.0.1:8123' 

시도

관련 문제