作為使用者查找不正確,但在 root 處查找正確

作為使用者查找不正確,但在 root 處查找正確

我有一台運行 Mavericks 的新 OSX 機器,並且在訪問 ruby​​gems.org 時遇到了一個有趣的情況。

作為普通用戶:

  $ curl http://rubygems.org|head                
  curl: (7) Failed connect to rubygems.org|head:8080; Connection refused

但使用 sudo:

   $ sudo curl http://rubygems.org |head 
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                           Dload  Upload   Total   Spent    Left  Speed
    100  9181    0  9181    0     0   6847      0 --:--:--  0:00:01 --:--:--  6851
  <!DOCTYPE html>    
  <html lang="en">
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta name="google-site-verification" content="AuesbWQ9MCDMmC1lbDlw25RJzyqWOcDYpuaCjgPxEZY" />
   <link rel="apple-touch-icon" href="/touch-icon-iphone.png" />
   <link rel="apple-touch-icon" sizes="72x72" href="/touch-icon-ipad.png" />
   <link rel="apple-touch-icon" sizes="114x114" href="/touch-icon-iphone4.png" />
   <link rel="fluid-icon" href="/fluid-icon.png"/>
   <link rel="search" type="application/opensearchdescription+xml" title="RubyGems.org" href="/opensearch.xml">

我以前從未見過這個 - 為什麼它會以用戶身份轉到 8080?我怎樣才能解決這個問題?

答案1

也許用戶環境中配置了代理伺服器?我首先運行“set|grep 8080”來查看是否有任何變數包含 8080。這樣可以重複嗎?即使管道周圍有空間,也會發生這種情況嗎(不,這不是必需的,但如果它改變了錯誤,它可能會有所啟發)。原始命令是否是從某些東西複製而來的,使得管道實際上可能是其他一些非 ASCII 字元?

相關內容