Edit report at https://bugs.php.net/bug.php?id=63766&edit=1

 ID:                 63766
 User updated by:    mattsch at gmail dot com
 Reported by:        mattsch at gmail dot com
 Summary:            sftp upload CURLOPT_URL errors with code 79 with
                     directory path
 Status:             Not a bug
 Type:               Bug
 Package:            cURL related
 Operating System:   Gentoo
 PHP Version:        5.4.9
 Block user comment: N
 Private report:     N

 New Comment:

In addition, if I modify the test script and it with a slash at the end, it 
also fails in the same way:

upload('sftp://domain.tld:/tmp/');


Previous Comments:
------------------------------------------------------------------------
[2012-12-18 15:49:54] mattsch at gmail dot com

That does not explain why it fails when you try to upload to a directory.  So 
what you're saying is this is not a bug because it's not possible to do this 
with curl and you must always specify a url with a filename to upload a file?  
And if that's the case, why is it not possible to upload a file to a directory?

------------------------------------------------------------------------
[2012-12-18 07:20:48] paj...@php.net

See previous comments

------------------------------------------------------------------------
[2012-12-18 07:11:27] bag...@php.net

The CURLOPT_URL option is of course to generically set a URL to work with. 
libcurl accepts whatever URL you set and will try to work on it once you ask 
curl to perform on it.

A URL that ends with a slash is treated as a directory by libcurl when you're 
downloading something from it. It will then (depending on protocol) ask for a 
directory listing instead of trying to fetch a file with that name.

libcurl assumes the users knows what (s)he is doing and will try to perform the 
requested operation on the given URL. Uploading to a directory name is probably 
going to fail on most systems.

------------------------------------------------------------------------
[2012-12-17 14:48:16] mattsch at gmail dot com

Could you elaborate as to why this would be a bad url?  The documentation on 
the curl website seems to indicate that you can specify a url without a 
filename at the end but then the examples are not specific to upload:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL

------------------------------------------------------------------------
[2012-12-17 12:17:00] bag...@php.net

This is not a libcurl bug. If you think about it for a while, libcurl doesn't 
know the 'foo' name, it is only given the (bad) URL and it cannot but to fail 
in 
this case.

I'm also convinced you can see the same problem with other protocols than SFTP 
for the same reason.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63766


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63766&edit=1

Reply via email to