Skip to content


Subversion checkout URL

You can clone with
Download ZIP


jam install/search fails behind proxy #86

marclitchfield opened this Issue · 3 comments

3 participants


using 0.2.11 on windows behind a proxy. I am specifying the proxy with the HTTP_PROXY variable. The couchdb client sends a relative path, which our proxy server rejects with the following error:

HTTP/1.1 502 Proxy Error ( The Uniform Resource Locator (URL) does not use a recognized protocol. Either the protocol is not supported or the request was not typed correctly. Confirm that a valid protocol is in use (for example, HTTP for a Web request). )

As an experiment I prepended 'http://' + to the path variable in the CouchDB.prototype.client method in couchdb.js, and the search and install operations succeeded.

Here is the output from jam:

C:\Program Files\Sysinternals>jam install jquery
installing from repositories jquery
Building version tree...
repositories checking "jquery"
proxy proxysrv01:80
Error: 502: Bad Gateway
    at Function.exports.statusCodeError (C:\Users\mlitchfield\AppData\Roaming\npm\node_modules\jamjs\lib\couchdb.js:280:16)
    at ClientRequest.CouchDB.client (C:\Users\mlitchfield\AppData\Roaming\npm\node_modules\jamjs\lib\couchdb.js:223:32)
    at ClientRequest.EventEmitter.emit (events.js:88:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
    at Socket.socketOnData [as ondata] (http.js:1356:20)
    at TCP.onread (net.js:410:27)
@jonsharratt jonsharratt referenced this issue from a commit in redbadger/jam
@jonsharratt jonsharratt Work for issue #86
Added fully qualified path when dealing with proxy servers.  They require validation of the requested endpoint when getting and installing packages.

I got this problem on 2012-12-07 too.

jam version 0.2.11, proxy server is squid/2.5.STABLE14

and proxy url should be: or

here comes my output:

installing from repositories jquery
Building version tree...
repositories checking "jquery"

Unexpected response
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
While trying to retrieve the URL:
<A HREF="/repository/jquery">/repository/jquery</A>
The following error was encountered:
Invalid URL
Some aspect of the requested URL is incorrect.  Possible problems:
<LI>Missing or incorrect access protocol (should be `http://'' or similar)
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
<P>Your cache administrator is <A HREF="mailto:root">root</A>. 
<BR clear="all">
<HR noshade size="1px">
Generated Fri, 07 Dec 2012 01:55:16 GMT by (squid/2.5.STABLE14)

Error: 400: Bad Request
    at Function.exports.statusCodeError (/home/zx1986/.nvm/v0.8.14/lib/node_modules/jamjs/lib/couchdb.js:280:16)
    at IncomingMessage.CouchDB.client (/home/zx1986/.nvm/v0.8.14/lib/node_modules/jamjs/lib/couchdb.js:251:44)
    at IncomingMessage.EventEmitter.emit (events.js:126:20)
    at IncomingMessage._emitEnd (http.js:366:10)
    at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
    at Socket.socketOnData [as ondata] (http.js:1367:20)
    at TCP.onread (net.js:403:27)

I think I'm also having this issue with install/search behind a proxy. I'm not getting the same error, but I am behind a proxy on windows 7 and I can't think of anything else that would cause this.

$ jam search jquery
Error: Error: connect ETIMEDOUT
at errnoException (net.js:781:11)
at Object.afterConnect as oncomplete
Error: Error: socket hang up
at createHangUpError (http.js:1253:15)
at Socket.socketCloseListener (http.js:1304:23)
at Socket.EventEmitter.emit (events.js:115:20)
at Socket._destroy.destroyed (net.js:358:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)


Hi, I have updated jam to 0.2.17 and I am no longer able to reproduce my original issue behind the same corporate proxy. It appears as if the fix addressed the problem I was having. jam install is working great now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.