[Mono-bugs] [Bug 333985] FtpWebRequest cannot put file properly.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 6 04:54:58 EST 2007


Andy Hume <andyhume32 at yahoo.co.uk> changed:

           What    |Removed                                         |Added
                 CC|                                                |andyhume32 at yahoo.co.uk

--- Comment #7 from Andy Hume <andyhume32 at yahoo.co.uk>  2007-11-06 02:54:57 MST ---
I think both this report and bug 324683 are the issue I describe below, that
Mono assumes the path given in the URI is absolute.  The problem should affect
all operation types, so Jerome can you see if the same issue occurs if you use

So the fix is two parts, first don't use normal paths as absolute, and secondly
handle the hex-encoded characters -- or maybe that just falls out from the URI
decoding mechanism.

On FTP servers often the initial login directory is not the root directory. 
Thus MSFT's FtpWebRequest does not assume that the path is absolute.  For
example, with "ftp://host/foo/..." they don't do e.g. "CWD /foo", but instead
do "CWD foo" (in effect).  They do provide a method (hack) to specify that the
path is absolute, see
http://blogs.msdn.com/mariya/archive/2006/03/06/544523.aspx i.e. embed %2F
('/') at the front of the path!  They also support %2E%2E for '..'

Mono however currently takes the path as absolute.  Thus problems occur
whenever the initial directory is not /.  For instance on my web hosting ftp
server when I login and do "pwd" I see "/andyhume".  So for example, with URI:
"ftp://ftp.example.com/example.com/temp/foobarMono" and method
WebRequestMethods.Ftp.MakeDirectory.  MSFT succeeds, but Mono fails with:
"System.Net.WebException: Server returned an error: 550
/example.com/temp/foobarMono: Access is denied.", as I have no write
permissions on /.

The sequence of commands is respectively:
• USER, PASS, OPTS utf8 on, "PWD" which returns "/andyh", "CWD
/andyh/example.com/temp/", "MKD foobarMSFT
• USER, PASS, "MKD /example.com/temp/foobarMono"

And with MSFT if I change the URI to the full absolute path and include the %2F
i.e.  "ftp://ftp.example.com/%2Fandyh/example.com/temp/foobarMSFT_Absolute"
that works too.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list