Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
I want to connect to FTP from behind proxy server. So I tried to set proxy address and protocol in Tools|Options|General and set Manual Proxy Settings and in Advanced Proxy Settings checked the "Use the same proxy settings for all protocols" but nothing works.
I tried to uncheck the "Use the same proxy settings for all protocols", then I tried Use System Proxy Settings, but still nothing. FTP credentials and proxy settings are 100% correct.
Every time I test connections, it ends up with some error. See the attached log, there are recorded to attempts with two different error messages.
Created attachment 106349 [details]
From the exception looks that your NB tries to connect through SOCKS4 and your proxy accept probably SOCKS5. Can it be this case?
This is indeed a problem. I posted about it on the Netbeans forums (http://forums.netbeans.org/viewtopic.php?t=36596), but haven't heard back. I'm using Mac OS X 10.6.6 with Netbeans 6.9.1, and I can confirm that the proxy settings do not work as shown in the options. I cannot get FTP to work from behind my proxy server. When I connect via OpenVPN to my home LAN (effectively bypassing the proxy), it works just fine. Also, other apps (such as FileZilla) work perfectly with the same proxy server/port settings for FTP behind my company's proxy server. There is definitely something in Netbeans that needs to be looked at in regards to how the proxy server works for FTP.
When I try to connect via FTP, I get an error that says, "Cannot connect to server. Cause: timeout: socket is not established." I have entered my proxy server IP address and port in the Netbeans options under "Manual Proxy Settings," and I even tried enabling the proxy setting to "use the same proxy settings for all protocols," but I still cannot get it to connect.
I´m sorry for not responding, I will try to find out the version of proxy as soon as possible
I tried to evaluate this bug in a last few days, but what I evaluated...just that it doesn't work for me.
My use case:
I was behind a proxy, which used http protocol type (you see, NO SOCKS4 and NO SOCKS5).
When I used FileZilla to connect to my ftp, it worked without any problems.
But when I tried to use netbeans, it failed.
What I noted, was this line in my NB output:
INFO [org.netbeans.core.NbProxySelector]: Incomplete SOCKS Server [/] found in ProxySelector[Type: 2] for uri socket://salma.profitux.cz:21.
What the hell is that? I filled ONLY "Proxy Settings -> Http Proxy", only http, I didn't checked "Use the same proxy..." in the "More..." settings window.
So I looked into that class source code http://bit.ly/gmIZs2 and I see, that it's logged on line 169. But how could I get there? It's else branch for SOCKS type only...so it's because condition on line 140 was false. Because protocol, of my uri, didn't start with "http". And what is my uri? You can read it from that logged line...it's socket://salma.profitux.cz:21.
And I really don't know, why there is a socket:// prefix...in my ftp configuration I only set "salma.profitux.cz" as a host and "21" as a port. So it was prefixed by someone and somwhere...but why? And where?
So the conclusion:
These errors are invoked when you are using proxy which uses HTTP proxy type.
It doesn't matter what you set to NetBeans proxy config, because everything fallbacks to SOCKS usage.
- if you set SOCKS proxy, and your proxy doesn't use this type, you get Bad version error...
- if you set HTTP proxy only, and your proxy USES this type, it just fallbacks to SOCKS (which isn't configured) and it ends up with an exception
So what should be a next step? Try to evaluate why a "uri" is prefixed by "socket://"...I think, that it shouldn't be. But where is it set? Maybe somwhere in core...:-/
Or maybe that mistake is entirely somewhere else...:-)
Please, can you confirm, that you are using proxy with HTTP PROXY TYPE?
Ondro, could you please contact Jirka Rechtacek. He is working on proxy setting for all ide.
Jirko, do you have any notion, where could be a problem?
Turns out that my proxy doesn't support other protocol than http, so I close the bug as invalid. Sorry for the problems.
I reopened this issue, because the bug is still there. I'm able to reproduce it.
But it's not so simple to fix it. There should be updated "libs.commons_net" module. It's version is too old and in the version 2.2 there is an experimental FTPHTTPClient class which could solve our problem.
But with that it's connected whole rewriting of the FTP support in the php.project module.
We should wait when FTPHTTPClient class will no longer be an experimental, then we can update "libs.commons_net" module and try to rewrite FTP support in php.project module. And for now I'll request a waiver.
I agree with waiver for NB 7.0 .
Still waiting for FTPHTTPClient class will not be an experimental.
Justification for waiver:
This issue cannot be fixed on NetBeans' side because NetBeans uses third-party library for FTP (Apache commons-net library , wrapped as NetBeans library). This library does not support HTTP proxy (at least in the current version).
Possible solution for NB 7.1:
- update this FTP library to new major version (3.x)
- increase major version of the wrapped NB library (since the new FTP library is not fully compatible with the previous release currently used in NetBeans)
- minor changes in NetBeans code using this library
However, this is not decided yet since the new version of the FTP library supports HTTP proxy only in _experimental_ mode .
OK, since we upgraded FTP library we use in NetBeans, I tried to use the FTPHTTPClient class as mentioned earlier. But I found some issues that means that we cannot use it (right, the class is experimental); filed as .
What is the proper way to continue with this issue? I suggest to downgrade it to P4 since there's likely nothing we can do on NetBeans' side and setting TM to Next. If there is better/another resolution for this issue, just let me know or simply do it.
(In reply to comment #14)
> OK, since we upgraded FTP library we use in NetBeans, I tried to use the
> FTPHTTPClient class as mentioned earlier. But I found some issues that means
> that we cannot use it (right, the class is experimental); filed as .
> What is the proper way to continue with this issue? I suggest to downgrade it
> to P4 since there's likely nothing we can do on NetBeans' side and setting TM
> to Next. If there is better/another resolution for this issue, just let me know
> or simply do it.
>  https://issues.apache.org/jira/browse/NET-422
I submitted a patch to apache for that issue or rather https://issues.apache.org/jira/browse/NET-267 to correct/complete the FTPHTTPClient code in commons-net.
(In reply to comment #15)
> I submitted a patch to apache for that issue or rather
> https://issues.apache.org/jira/browse/NET-267 to correct/complete the
> FTPHTTPClient code in commons-net.
Thanks a lot for it! But we definitely need to wait for a new version of Commons-Net library (with this patch applied).
Is there any progress in this issue? commons-net has fixed this bug https://issues.apache.org/jira/browse/NET-422, so if you upgrade to 3.1 this should do it.
It is a pain having to sync projects outside netbeans using filezilla.
Sorry, I did not noticed it. I need to check whether the commons-net library upgrade can be done for NB 7.3 or not. Thanks for the reminder.
The library update is possible, I will do it first and then will try to fix this issue.
Should be fixed I hope. Please notice that HTTP proxy is used only for pure FTP (without any TLS).
Láďo or anyone else, please verify if possible.
I'll try it today, thanks.
Indeed it seems to work :) I tried to create project, download, upload on save and it works. It's not really fast but that could be due to our proxy...
One think I notice and wasn't clear to me. In Tools|Options if I check to use the same proxy host:port for all protocols, then it doesn't work and IDE log contains:
INFO [org.netbeans.modules.php.project.connections.ftp.FtpClient]: Exception while connecting
java.net.SocketException: Malformed reply from SOCKS server
[catch] at org.netbeans.modules.php.project.connections.ftp.FtpClient.connect(FtpClient.java:187)
Does it mean that if set, it prefers SOCKS?
Product Version: NetBeans IDE Dev (Build web-main-9264-on-20121120)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16
System: Linux version 3.2.0-33-generic-pae running on i386; UTF-8; en_US (nb)
(In reply to comment #22)
> Does it mean that if set, it prefers SOCKS?
I really don't know - JirkoŘ, do you know? Anyway, I will look at it.
Thanks a lot.
So, I don't know since the proxy is returned the same (just verified using debugger).
BTW FTPHTTPClient is still experimental and the exception comes from it so perhaps it is a bug?
Integrated into 'main-golden', will be available in build *201211211016* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Tomas Mysik <firstname.lastname@example.org>
Log: #195879 - Connect to FTP using HTTP proxy not working