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

Proxy #24

Open
GalawynRM opened this issue Nov 17, 2014 · 11 comments
Open

Proxy #24

GalawynRM opened this issue Nov 17, 2014 · 11 comments

Comments

@GalawynRM
Copy link
Contributor

Great work,

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

@tobipch
Copy link
Contributor

tobipch commented Nov 17, 2014

How do you mean that?

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

@GalawynRM
Copy link
Contributor Author

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

@cfjedimaster
Copy link
Owner

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 notifications@github.com 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
#24 (comment)
.

Raymond Camden, Web Developer for Adobe

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

@GalawynRM
Copy link
Contributor Author

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);
});

@cfjedimaster
Copy link
Owner

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 notifications@github.com 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
#24 (comment)
.

Raymond Camden, Web Standards Evangelist

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

@GalawynRM
Copy link
Contributor Author

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

@cfjedimaster
Copy link
Owner

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 notifications@github.com 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
#24 (comment)
.

Raymond Camden, Web Standards Evangelist

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

@GalawynRM
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@cfjedimaster
Copy link
Owner

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 notifications@github.com 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
#24 (comment)
.

Raymond Camden, Web Standards Evangelist

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

@GalawynRM
Copy link
Contributor Author

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

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

No branches or pull requests

3 participants