IETF-SSH archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: I-D ACTION:draft-ietf-secsh-scp-sftp-ssh-uri-00.txt



 What about syntax:

secsh_URI := secsh_scheme "://" [secsh_userinfo] "@" ] host [ ":" port ] [; params] [abs_path]
secsh_scheme := {ssh|scp|sftp}
abs_path := "/" path_segments
path_segments := ["/"] segment [ "/" segment]
params := parameter=value [, parameter=value]

- when path_segments begin with "/" or "%2F" => path is relative to "/" or "My Computer(?)" :) for windows otherwise to user home directory. - when parameter is not supported by scheme should be ignored - as example typecode for ssh.



Misc.:
I hope that attached shell script "ftp-url-test.sh" will help to understand ftp urls. Script use two programs wget and curl. Before to run we should create directory "c:" in user home "${HOME}" and in root "/" and file path.txt in them, i.e.:
-----------------------------------------------------------------------------
$ cd
$ mkdir 'c:'
$ cd 'c:'
$ pwd > path.txt
$ su -
# cd /
# mkdir 'c:'
# cd 'c:'
# pwd > path.txt
-----------------------------------------------------------------------------

output from script is similar to:
-----------------------------------------------------------------------------
=== port:=
===[ftp://test:change_it@localhost/c:/path.txt]===
wget->/home/test/c:
curl->/home/test/c:
===[ftp://test:change_it@localhost/c%3A/path.txt]===
wget->/home/test/c:
curl->/home/test/c:
===[ftp://test:change_it@localhost//c:/path.txt]===
wget->/c:
curl->/c:
===[ftp://test:change_it@localhost//c%3A/path.txt]===
wget->/c:
curl->/c:
===[ftp://test:change_it@localhost/%2Fc%3A/path.txt]===
wget->/c:
curl->/c:
=== port:=21
===[ftp://test:change_it@localhost:21/c:/path.txt]===
wget->/home/test/c:
curl->/home/test/c:
===[ftp://test:change_it@localhost:21/c%3A/path.txt]===
wget->/home/test/c:
curl->/home/test/c:
===[ftp://test:change_it@localhost:21//c:/path.txt]===
wget->/c:
curl->/c:
===[ftp://test:change_it@localhost:21//c%3A/path.txt]===
wget->/c:
curl->/c:
===[ftp://test:change_it@localhost:21/%2Fc%3A/path.txt]===
wget->/c:
curl->/c:
-----------------------------------------------------------------------------
Browsers:
- Konqueror 3.0.x ( not tested with versions > 3.1 and < 3.0 ) always download "/c:/path.txt" :-( - ftp in Opera 6.0 (not tested with versions >= 6.1 and < 6) is not stable (problems with userinfo and ":" in path).
- Gecko (not tested with versions < 1.0) - fine
- IE - not tested.
- Comunicator (Netcape 4.7x):
- "ftp://user:pass@host"; list user home dir and change url to ftp://user@host/path_to_user_home
 - "ftp://user:pass@host/"; list root directory
, i.e. depend from implementation  :-(

Bill Sommerfeld wrote:

scp://hostname/c:/bin/thingy

Isn't there current a similar problem with ftp urls?

It would seem that in order to form the URL you would have to convert
path-separators into / to fit into URL syntax. I think this is what is
done with FTP.
yep, that matches my (possibly lossy) understanding of ftp as well
(shortly after NetBSD's ftp client was extended to take url's on the
command line, there was a followup code change to do individual
cd's for each URL component ..)

#!/bin/sh
# Author: Roumen Petrov

WGET="wget"
WGET_OPT="--proxy=off -e verbose=off -e debug=off -e server_response=off --output-document=-"

CURL="curl"
CURL_OPT=""

DEFAULT_PORT="21"


# ===
scheme="ftp"

user="${USER}"
pass="change_it"
userinfo="${user}:${pass}"

host="localhost"

for port in '' 21; do
  echo "=== port:=${port}"

  hostport=""
  #if test -n "${port}" -a "${port}" != "${DEFAULT_PORT}"; then
  if test -n "${port}"; then
    hostport="${host}:${port}"
  else
    hostport="${host}"
  fi

  for abs_path in \
    'c:/path.txt' \
    'c%3A/path.txt' \
    '/c:/path.txt' \
    '/c%3A/path.txt' \
    '%2Fc%3A/path.txt' \
  ; do
    URL="${scheme}://${userinfo}@${hostport}/${abs_path}"

    echo "===[${URL}]==="
    printf "wget->"; ${WGET} ${WGET_OPT} "${URL}" 2>/dev/null
    printf "curl->"; ${CURL} ${CURL_OPT} "${URL}" 2>/dev/null
  done
done





Home | Main Index | Thread Index | Old Index