소스 검색

get_proxy() is using "http://" which fools get_proxies_by_url() into thinking
the empty servername matches the unspecified (and empty) directhost
(when no directhosts are specified) which messes up the proxy code.
Fixed.

Joseph Lee 22 년 전
부모
커밋
499d5a095f
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      panda/src/downloader/httpClient.cxx

+ 6 - 4
panda/src/downloader/httpClient.cxx

@@ -449,11 +449,13 @@ get_proxies_for_url(const URLSpec &url, pvector<URLSpec> &proxies) const {
   // First, check if the hostname matches any listed in direct_hosts.
   string hostname = url.get_server();
 
-  DirectHosts::const_iterator si;
-  for (si = _direct_hosts.begin(); si != _direct_hosts.end(); ++si) {
-    if ((*si).matches(hostname)) {
+  if (!hostname.empty()) { // skip if hostname is just an empty 'http://' scheme
+    DirectHosts::const_iterator si;
+    for (si = _direct_hosts.begin(); si != _direct_hosts.end(); ++si) {
+      if ((*si).matches(hostname)) {
       // It matches, so don't use any proxies.
-      return;
+        return;
+      }
     }
   }