diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-05-08 11:34:31 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-05-08 11:34:31 +0000 |
commit | 1b7f00b2a68b59249181dac6557630e20f394ea6 (patch) | |
tree | 5adbdaf340f21646e1529e9c4aaccb3e8a0c4531 | |
parent | ad19f95f15bac425c1b37a7a260025d8fc9fe63c (diff) |
CURLE_FTP_COULDNT_STOR_FILE is now known as CURLE_UPLOAD_FAILED. This is
because I just made SCP uploads return this value if the file size of
the upload file isn't given with CURLOPT_INFILESIZE*. Docs updated to
reflect this news, and a define for the old name was added to the public
header file.
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | docs/libcurl/curl_easy_setopt.3 | 5 | ||||
-rw-r--r-- | docs/libcurl/libcurl-errors.3 | 34 | ||||
-rw-r--r-- | include/curl/curl.h | 3 | ||||
-rw-r--r-- | lib/ssh.c | 12 | ||||
-rw-r--r-- | lib/strerror.c | 4 |
6 files changed, 51 insertions, 14 deletions
@@ -6,6 +6,13 @@ Changelog +Daniel S (8 May 2007) +- CURLE_FTP_COULDNT_STOR_FILE is now known as CURLE_UPLOAD_FAILED. This is + because I just made SCP uploads return this value if the file size of + the upload file isn't given with CURLOPT_INFILESIZE*. Docs updated to + reflect this news, and a define for the old name was added to the public + header file. + Daniel S (7 May 2007) - James Bursa fixed a bug in the multi handle code that made the connection cache grow a bit too much, beyond the normal 4 * easy_handles. diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3 index 78c58885a..3c8c4596e 100644 --- a/docs/libcurl/curl_easy_setopt.3 +++ b/docs/libcurl/curl_easy_setopt.3 @@ -1035,6 +1035,9 @@ When uploading a file to a remote site, this option should be used to tell libcurl what the expected size of the infile is. This value should be passed as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP. +For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP is +mandatory. + Note that this option does not limit how much data libcurl will actually send, as that is controlled entirely by what the read callback returns. .IP CURLOPT_INFILESIZE_LARGE @@ -1042,6 +1045,8 @@ When uploading a file to a remote site, this option should be used to tell libcurl what the expected size of the infile is. This value should be passed as a curl_off_t. (Added in 7.11.0) +For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory. + Note that this option does not limit how much data libcurl will actually send, as that is controlled entirely by what the read callback returns. .IP CURLOPT_UPLOAD diff --git a/docs/libcurl/libcurl-errors.3 b/docs/libcurl/libcurl-errors.3 index 062bf83de..a2c071cb1 100644 --- a/docs/libcurl/libcurl-errors.3 +++ b/docs/libcurl/libcurl-errors.3 @@ -1,8 +1,27 @@ -.\" You can view this file with: -.\" nroff -man [file] -.\" $Id$ +.\" ************************************************************************** +.\" * _ _ ____ _ +.\" * Project ___| | | | _ \| | +.\" * / __| | | | |_) | | +.\" * | (__| |_| | _ <| |___ +.\" * \___|\___/|_| \_\_____| +.\" * +.\" * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * +.\" * This software is licensed as described in the file COPYING, which +.\" * you should have received as part of this distribution. The terms +.\" * are also available at http://curl.haxx.se/docs/copyright.html. +.\" * +.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell +.\" * copies of the Software, and permit persons to whom the Software is +.\" * furnished to do so, under the terms of the COPYING file. +.\" * +.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +.\" * KIND, either express or implied. +.\" * +.\" * $Id$ +.\" ************************************************************************** .\" -.TH libcurl-errors 3 "9 Feb 2005" "libcurl 7.13.1" "libcurl errors" +.TH libcurl-errors 3 "8 May 2007" "libcurl 7.16.3" "libcurl errors" .SH NAME libcurl-errors \- error codes in libcurl .SH DESCRIPTION @@ -86,9 +105,10 @@ An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback. .IP "CURLE_MALFORMAT_USER (24)" This is never returned by current libcurl. -.IP "CURLE_FTP_COULDNT_STOR_FILE (25)" -FTP couldn't STOR file. The server denied the STOR operation. The error buffer -usually contains the server's explanation to this. +.IP "CURLE_UPLOAD_FAILED (25)" +Failed starting the upload. For FTP, the server typcially denied the STOR +command. The error buffer usually contains the server's explanation to this. +(This error code was formerly known as CURLE_FTP_COULDNT_STOR_FILE.) .IP "CURLE_READ_ERROR (26)" There was a problem reading a local file or an error returned by the read callback. diff --git a/include/curl/curl.h b/include/curl/curl.h index 32a9a14cf..000335b74 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -331,7 +331,7 @@ typedef enum { CURLE_HTTP_RETURNED_ERROR, /* 22 */ CURLE_WRITE_ERROR, /* 23 */ CURLE_MALFORMAT_USER, /* 24 - NOT USED */ - CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */ + CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ CURLE_READ_ERROR, /* 26 - could open/read from file */ CURLE_OUT_OF_MEMORY, /* 27 */ /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error @@ -422,6 +422,7 @@ typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ /* backwards compatibility with older names */ #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED +#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED #endif typedef enum { @@ -562,11 +562,15 @@ CURLcode Curl_scp_do(struct connectdata *conn, bool *done) *done = TRUE; /* unconditionally */ if (conn->data->set.upload) { + if(conn->data->set.infilesize < 0) { + failf(conn->data, "SCP requries a known file size for upload"); + return CURLE_UPLOAD_FAILED; + } /* - * NOTE!!! libssh2 requires that the destination path is a full path - * that includes the destination file and name OR ends in a "/" . - * If this is not done the destination file will be named the - * same name as the last directory in the path. + * libssh2 requires that the destination path is a full path that includes + * the destination file and name OR ends in a "/" . If this is not done + * the destination file will be named the same name as the last directory + * in the path. */ scp->ssh_channel = libssh2_scp_send_ex(scp->ssh_session, scp->path, LIBSSH2_SFTP_S_IRUSR| diff --git a/lib/strerror.c b/lib/strerror.c index b07067cec..118c98ede 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -123,8 +123,8 @@ curl_easy_strerror(CURLcode error) case CURLE_WRITE_ERROR: return "failed writing received data to disk/application"; - case CURLE_FTP_COULDNT_STOR_FILE: - return "failed FTP upload (the STOR command)"; + case CURLE_UPLOAD_FAILED: + return "upload failed (at start/before it took off)"; case CURLE_READ_ERROR: return "failed to open/read local data from file/application"; |