Bug #63766 [Com]: sftp upload CURLOPT_URL errors with code 79 with directory path

From: Date: Tue, 18 Dec 2012 07:11:28 +0000
Subject: Bug #63766 [Com]: 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-175426@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
 Comment by:         bagder@php.net
 Reported by:        mattsch at gmail dot com
 Summary:            sftp upload CURLOPT_URL errors with code 79 with
                     directory path
 Status:             Open
 Type:               Bug
 Package:            cURL related
 Operating System:   Gentoo
 PHP Version:        5.4.9
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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] bagder@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.

------------------------------------------------------------------------
[2012-12-17 01:23:46] aharvey@php.net

Reopened per previous comments, although I wonder if this might be a libcurl issue rather than a PHP
one.

------------------------------------------------------------------------
[2012-12-14 22:50:27] mattsch at gmail dot com

"foo" designates a file and not a directory.  Perhaps my test script should have been more
clear by using a file extension like .txt or something.  The file I am trying to upload is being
uploaded to a directory that already exists on the remote server.

------------------------------------------------------------------------
[2012-12-14 22:47:01] mattsch at gmail dot com

This is a bug.  I am not trying to upload anything recursively.  I am simply trying to upload one
file to a directory.  When I don't specify the target filename on the url, I expect that the
target file created on the remote server is the same name as the filename that I am uploading.

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


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


Thread (12 messages)

« previous php.bugs (#175426) next »