Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync repo through http_proxy #607

Closed
luicfer opened this issue Mar 3, 2015 · 17 comments · Fixed by #608
Closed

sync repo through http_proxy #607

luicfer opened this issue Mar 3, 2015 · 17 comments · Fixed by #608
Assignees
Labels
Milestone

Comments

@luicfer
Copy link

luicfer commented Mar 3, 2015

The server is behind firewall.How to sync repo through http_proxy?

@fengmk2
Copy link
Member

fengmk2 commented Mar 4, 2015

Need to make urllib support proxy first.

@luicfer
Copy link
Author

luicfer commented Mar 4, 2015

this means for now.cnpmjs.org is not support http_proxy?

@fengmk2
Copy link
Member

fengmk2 commented Mar 4, 2015

yep, I will try to add http_proxy support for urllib this weekend.

@fengmk2
Copy link
Member

fengmk2 commented Mar 8, 2015

@luicfer can you run this test on your proxy?

var urllib = require('urllib')
var tunnel = require('tunnel-agent');

var tunnelingAgent = tunnel.httpsOverHttp({
  proxy: {
    host: 'your-proxy-host',
    port: $port
  }
});

urllib.request('https://registry.cnpmjs.org', {
   httpsAgent: tunnelingAgent
}, function (err, data, res) {
  console.log(err, res.statusCode, res.headers);
});

@fengmk2
Copy link
Member

fengmk2 commented Mar 8, 2015

tunnel-agent work fine on my proxy

@luicfer
Copy link
Author

luicfer commented Mar 9, 2015

run the script.

{ [RequestError: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND http://10.16.1.131 (req "error"), GET https://registry.cnpmjs.org -1 (connnected: false, keepalive socket: false)
headers: {}]
  code: 'ECONNRESET',
  name: 'RequestError',
  data: undefined,
  path: '/',
  status: -1,
  headers: {},
  res:
   { status: -1,
     statusCode: -1,
     headers: {},
     size: 0,
     aborted: false,
     rt: 44,
     keepAliveSocket: false } } -1 {}

fengmk2 added a commit that referenced this issue Mar 9, 2015
@fengmk2 fengmk2 self-assigned this Mar 9, 2015
@fengmk2 fengmk2 added this to the 2.0 milestone Mar 9, 2015
@fengmk2
Copy link
Member

fengmk2 commented Mar 9, 2015

@luicfer pr #608

@fengmk2
Copy link
Member

fengmk2 commented Mar 9, 2015

@luicfer I try it through my http proxy, it work for me.

@luicfer
Copy link
Author

luicfer commented Mar 9, 2015

run the test. Connection timeout.

{ [ConnectionTimeoutError: Request#1 timeout for 15000ms, GET https://twitter.com -1
headers: {}]
  name: 'ConnectionTimeoutError',
  data: undefined,
  path: '/',
  status: -1,
  headers: {},
  res:
   { status: -1,
     statusCode: -1,
     headers: {},
     size: 0,
     aborted: false,
     rt: 15031 } }
-1 {}

@fengmk2
Copy link
Member

fengmk2 commented Mar 9, 2015

... @luicfer change the twitter.com, use other like https://registry.npmjs.com. Your proxy can't cross the GFW...

@luicfer
Copy link
Author

luicfer commented Mar 9, 2015

request https://registry.npmjs.com.get status code 200.It's done!!

fengmk2 added a commit that referenced this issue Mar 9, 2015
fengmk2 added a commit that referenced this issue Mar 9, 2015
@fengmk2
Copy link
Member

fengmk2 commented Mar 9, 2015

嗯,那就 ok 了。等 pr 合并我发一个版本,你配置一下 config.js 里面的 httpProxy 参数就好了。

@luicfer
Copy link
Author

luicfer commented Mar 9, 2015

我们应该继续英文嘛,说中文多不好

@xysDavid
Copy link

好像npm还没有发布这个修改?什么时候能发布到npm呢?

@fengmk2
Copy link
Member

fengmk2 commented May 11, 2015

@xysDavid cnpmjs.org@2.0.0

@fengmk2
Copy link
Member

fengmk2 commented May 11, 2015

@luicfer

@island205
Copy link

[root@cnpm cnpmjs.org]# http_proxy=http://$http_proxy node --harmony test/request_with_httpproxy.js http://registry.npm.taobao.org/-/short
{ [RequestError: tunneling socket could not be established, cause=Parse Error (req "error"), GET http://registry.npm.taobao.org/-/short -1
headers: {}]
  code: 'ECONNRESET',
  name: 'RequestError',
  data: undefined,
  path: '/-/short',
  status: -1,
  headers: {},
  res:
   { status: -1,
     statusCode: -1,
     headers: {},
     size: 0,
     aborted: false,
     rt: 27 } }
-1 {}

我是不是碰到防火墙了?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants