On Mon, Oct 19, 2020 at 10:40:30AM -0500, Michael Loutris wrote:
> I grabbed the libssh2.dll and generated a .lib for Windows and was able to 
> successfully transfer a file. 
> I suspect that my issue has to do with properly formatting the strings to 
> libcurl, and for Windows in particular. 
> 
> 1. I want to set the remote port for SFTP, so I believe that I should *NOT* 
> user CURLOPT_CONNECT_TO, but use CURLOPT_RESOLVE, correct? 

You don't need either of those options to set the report port. Just set it in
the URL, e.g. sftp://192.168.0.1:1234/file  Or, alternately, use CURLOPT_PORT.

> 2. The SSH/SFTP connection lies on an internal network, with no DNS or domain 
> names. In the CURLOPT_RESOLVE description, the curl_slist string has the 
> format HOST:PORT:ADDRESS
> Should I leave the HOST empty or repeat the address? 
> Which of the following formats do I use,  ":22:10.20.30.40"  or 
> "10.20.30.40:22:10.20.30.40"?

You don't need any of them. Just use the IP address in the URL, e.g. 
sftp://10.20.30.40:22/file  

> 3. When setting up the CURLOPT_URL, I need to connect to the server to a user 
> account on the D: drive. 
> I tried using the following call, but I'm afraid that it might be malformed. 
> Again, this is for SFTP between two Windows 10 machines.
> 
>   result = curl_easy_setopt( curlSessionHandle, CURLOPT_URL, 
> "sftp://[email protected]/~/Users/wi-19981-rda/Device_A/some_file"; );

The exact URL is going to be server-dependent. But, if the server supports ~
for the user's home directory then the URL will probably be
sftp://[email protected]/~/Device_A/some_file  Or, to use an absolute
path, something like 
sftp://[email protected]/Users/wi-19981-rda/Device_A/some_file

> I tried converting the slashes to the Windows format
>     
> "sftp:\\[email protected]\\~\\Users\\wi-19981-rda\\Device_A\\some_file"
> but then libcurl signals a protocol error.

Which makes sense since that isn't a URL.

> I'm already specifying the protocol in another option call, so is it 
> necessary to specify the protocol in the CURLOPT_URL call as well?

What option call? The protocol is part of the scheme in the URL so I'm not sure
what you can pass in as a URL that excludes that.

> 4. Does the D: drive need to be explicitly listed in the path, or is it 
> enough to use the /~/?

That's probably up to the server. If the user's home directory is on D: and the
URL uses a ~ to specify the home directory and the server supports ~ then yes,
that should be good enough.

Dan
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to