-
Notifications
You must be signed in to change notification settings - Fork 69
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
How to use PassiveMode? #10
Comments
Hi Matteo, It's possible to use the passive mode. I will give you an answer tonight. Regards. |
@matteocostantini By default, the FTP client is in passive mode (m_bActive is initialized to false), so there's nothing to do. To use the active mode use SetActive(true), in active mode, the client will choose a port and the FTP server will initialize the connection (not recommended if there's a firewall). |
This is my implementation, dont connect . i'm in UI environment. How i can use? My FTP credentials is valid ('m tryng with WINSCP!!) in FTPCLient.cpp go in this rows void BDImport::OnRunButton()
|
I never tested the FTP Client with this protocol CFTPClient::FTP_PROTOCOL::FTPES. If you are trying to access a normal FTP server (port 21), remove that parameter (it will default to FTP_PROTOCOL::FTP) or set the protocol to FTP_PROTOCOL::SFTP if you want to connect to an SFTP server (port 22). Also, in a debugger, check that the string parameters are well encoded (I don't know if CT2CA is doing its job properly). And that "stdHost" doesn't contain any protocol scheme. |
I'm not sure but to access secure servers, I think you need to set an SSL cert file with the static method SetSSLCertFile. You can use this file : https://curl.haxx.se/ca/cacert.pem (from libcurl website) and then UPDATE : ignore this comment |
@matteocostantini You can also compile with this preprocessor macro DEBUG_CURL, and use this method : Also, don't forget to set a preprocessor macro WINDOWS as I believe you are not using the CMake scripts. Regards. |
@embeddedmz : I'm able to connect to my server with this instructions:
Can you improve this calls in your ::Perform()? |
First of all, to what kind of FTP servers are you connecting (SFTP, FTPES or FTPS). I know that the client work with SFTP but not the 2 others (FTPES, FTPS). You can remove these 2 lines :
if you use this : curl_easy_setopt(m_pCurlSession, CURLOPT_CAINFO, "C:\....\cacert.pem"); In my previous comment I mistaken this for CFTPClient::SetSSLCertFile("C:\etc...............\cacert.pem"); it's missing in this client (but not in the httpclient-cpp). But your server must have a valid SSL certificate and not a quick & dirty one. Settings those 2 parameters to 0 is not good for all cases (security issues). So, if you have the chance to add and test these getter/setters method : // in .h // in .cpp In line 857 (
and eventually remove If everything is OK, create a pull request and I will merge your patches. |
the connection function successfully only if i put curl_easy_setopt(m_pCurlSession, CURLOPT_USE_SSL, CURLUSESSL_ALL); |
The server is ftp with explicit autentication |
@matteocostantini OK, I googled curl FTPS/FTPES and I found the following stuff : https://stackoverflow.com/questions/32491790/php-curl-ftpes-w-explicit-tls-ssl => in the code, instead of prefixing the URL with ftps:// prefix it with ftp:// that should be sufficient. https://curl.haxx.se/docs/manual.html (curl doc.) => FTPS : It is just like for FTP, but you may also want to specify and use SSL-specific options for certificates etc. So, can you please try this fix and tell me if the example you posted in the beginning of this thread is working : That should work fine (I hope so). |
No description provided.
The text was updated successfully, but these errors were encountered: