brackets-jsdownloader icon indicating copy to clipboard operation
brackets-jsdownloader copied to clipboard

Proxy

Open GalawynRM opened this issue 11 years ago • 11 comments
trafficstars

Great work,

It's planned at least a basic support of proxy servers?

GalawynRM avatar Nov 17 '14 09:11 GalawynRM

How do you mean that?

If you mean the support of library CDNs, I would also support that...

tobipch avatar Nov 17 '14 09:11 tobipch

So maybe i have some kind of problem, because even if i set a proxy for brackets, JSdownloader download a 0byte file when the connection is behind proxy

GalawynRM avatar Nov 17 '14 09:11 GalawynRM

No, there is no way in the plugin to make use of a proxy unless you do it it at the OS level.

On Mon, Nov 17, 2014 at 3:12 AM, GalawynRM [email protected] wrote:

So maybe i have some kind of problem, because even if i set a proxy for brackets, JSdownloader download a 0byte file when the connection is behind proxy

— Reply to this email directly or view it on GitHub https://github.com/cfjedimaster/brackets-jsdownloader/issues/24#issuecomment-63277073 .

Raymond Camden, Web Developer for Adobe

Email : [email protected] Blog : www.raymondcamden.com Twitter: raymondcamden

cfjedimaster avatar Nov 17 '14 12:11 cfjedimaster

I'm checking how to enable proxy support in your extension,

could this page be useful? (brackets has in the configuration, the proxy settings, in case would be wonderful to access to those properties)

http://stackoverflow.com/a/6781592

Using a HTTP proxy (for non secure requests) is very simple. You connect to the proxy and make the request normally except that the path part includes the full url and the host header is set to the host you want to connect to. Tim was very close with his answer but he missed setting the host header properly.

var http = require("http");

var options = { host: "proxy", port: 8080, path: "http://www.google.com", headers: { Host: "www.google.com" } }; http.get(options, function(res) { console.log(res); res.pipe(process.stdout); });

GalawynRM avatar Jan 19 '15 13:01 GalawynRM

Well, if there were UI for this (maybe a preferences icon in the UI) then the extension could make use of it. I'd be willing to accept a PR for this if you (or someone) wants to take a stab at it.

On Mon, Jan 19, 2015 at 7:36 AM, GalawynRM [email protected] wrote:

I'm checking how to enable proxy support in your extension,

could this page be useful? (brackets has in the configuration, the proxy settings, in case would be wonderful to access to those properties)

http://stackoverflow.com/a/6781592

Using a HTTP proxy (for non secure requests) is very simple. You connect to the proxy and make the request normally except that the path part includes the full url and the host header is set to the host you want to connect to. Tim was very close with his answer but he missed setting the host header properly.

var http = require("http");

var options = { host: "proxy", port: 8080, path: "http://www.google.com", headers: { Host: "www.google.com" } }; http.get(options, function(res) { console.log(res); res.pipe(process.stdout); });

— Reply to this email directly or view it on GitHub https://github.com/cfjedimaster/brackets-jsdownloader/issues/24#issuecomment-70492849 .

Raymond Camden, Web Standards Evangelist

Email : [email protected] Blog : www.raymondcamden.com Twitter: raymondcamden

cfjedimaster avatar Jan 19 '15 13:01 cfjedimaster

I'm trying to replace this from your "downloader.js"

if(item.href.indexOf("https") === 0) { https.get(item.href, resHandler); } else { http.get(item.href, resHandler); }

with similar calling as that page suggest, but for now i'm not able to make it work

GalawynRM avatar Jan 19 '15 14:01 GalawynRM

It would need to use an options structure for one. Also, I'd check to see if https can use proxy. if not, then it is pretty much out of the question for the plugin. (Unless you make the UI intelligently hide the https ones and use some sort of explanation)

On Mon, Jan 19, 2015 at 8:00 AM, GalawynRM [email protected] wrote:

I'm trying to replace this from your "downloader.js"

if(item.href.indexOf("https") === 0) { https.get(item.href, resHandler); } else { http.get(item.href, resHandler); }

with similar calling as that page suggest, but for now i'm not able to make it work

— Reply to this email directly or view it on GitHub https://github.com/cfjedimaster/brackets-jsdownloader/issues/24#issuecomment-70495821 .

Raymond Camden, Web Standards Evangelist

Email : [email protected] Blog : www.raymondcamden.com Twitter: raymondcamden

cfjedimaster avatar Jan 19 '15 14:01 cfjedimaster

is this helping for https ones? they suggest to use "Request" (i'm new to node.js and brackets extensions)

http://stackoverflow.com/a/21281075

Request, https://github.com/request/request

GalawynRM avatar Jan 19 '15 14:01 GalawynRM

i got some results with this

https://www.npmjs.com/package/global-tunnel

adding to the downloader.js

var globalTunnel = require('global-tunnel');

(but i needed to npm install it, i don't know if it's possible from a bracket extension installation.

there is even an option for global tunnel, to use the environment variables http_proxy.. etc.

GalawynRM avatar Jan 19 '15 14:01 GalawynRM

Well, I wish you luck. :) It isn't that I don't want to help per se, but I don't have the time right now to work on this. I am in favor of the PR though as I said.

On Mon, Jan 19, 2015 at 8:27 AM, GalawynRM [email protected] wrote:

i got some results with this

https://www.npmjs.com/package/global-tunnel

adding to the downloader.js

var globalTunnel = require('global-tunnel');

(but i needed to npm install it, i don't know if it's possible from a bracket extension installation.

there is even an option for global tunnel, to use the environment variables http_proxy.. etc.

— Reply to this email directly or view it on GitHub https://github.com/cfjedimaster/brackets-jsdownloader/issues/24#issuecomment-70500063 .

Raymond Camden, Web Standards Evangelist

Email : [email protected] Blog : www.raymondcamden.com Twitter: raymondcamden

cfjedimaster avatar Jan 19 '15 15:01 cfjedimaster

Yes of course, I'm trying to find a possible generic solution.

for now it's working on my local version, but with a require, that i don't know how to "embed" into the extension

GalawynRM avatar Jan 19 '15 15:01 GalawynRM