Bug #63766 [Nab]: sftp upload CURLOPT_URL errors with code 79 with directory path
| From: | mattsch at gmail dot com | Date: | Tue, 18 Dec 2012 16:06:38 +0000 |
| Subject: | Bug #63766 [Nab]: sftp upload CURLOPT_URL errors with code 79 with directory path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-175432@lists.php.net to get a copy of this message | ||
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:
Also the same thing happens when using scp://. What I don't understand is if I were to upload
the file on the command line with scp without specifying a filename but rather just a destination
directory, the file would upload. So why can't I expect curl to do the same when using the
same protocol?
Previous Comments:
------------------------------------------------------------------------
[2012-12-18 15:55:52] mattsch at gmail dot com
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/');
------------------------------------------------------------------------
[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] pajoye@php.net
See previous comments
------------------------------------------------------------------------
[2012-12-18 07:11:27] bagder@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
------------------------------------------------------------------------
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