diff options
author | Brad King <brad.king@kitware.com> | 2020-12-09 16:45:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-09 16:45:25 (GMT) |
commit | 54931fdff020f72bbd157fd1640a0fef52e4f183 (patch) | |
tree | 31e7f9ea89fb8ab0e17fe17efd881ea947962a4a /Utilities/cmcurl/lib/file.c | |
parent | 4cd65e5d882333e48155cf8b5bb52d088aa63cdf (diff) | |
parent | 5aacc593a961fe9ee1427c03d18fba8947a9e33d (diff) | |
download | CMake-54931fdff020f72bbd157fd1640a0fef52e4f183.zip CMake-54931fdff020f72bbd157fd1640a0fef52e4f183.tar.gz CMake-54931fdff020f72bbd157fd1640a0fef52e4f183.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2020-12-09 (e0528597)
Diffstat (limited to 'Utilities/cmcurl/lib/file.c')
-rw-r--r-- | Utilities/cmcurl/lib/file.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/Utilities/cmcurl/lib/file.c b/Utilities/cmcurl/lib/file.c index cd3e49c..a65eb77 100644 --- a/Utilities/cmcurl/lib/file.c +++ b/Utilities/cmcurl/lib/file.c @@ -9,7 +9,7 @@ * * 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 https://curl.haxx.se/docs/copyright.html. + * are also available at https://curl.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 @@ -67,8 +67,7 @@ #include "curl_memory.h" #include "memdebug.h" -#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || \ - defined(__SYMBIAN32__) +#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) #define DOS_FILESYSTEM 1 #endif @@ -112,6 +111,7 @@ const struct Curl_handler Curl_handler_file = { ZERO_NULL, /* connection_check */ 0, /* defport */ CURLPROTO_FILE, /* protocol */ + CURLPROTO_FILE, /* family */ PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */ }; @@ -119,8 +119,8 @@ const struct Curl_handler Curl_handler_file = { static CURLcode file_setup_connection(struct connectdata *conn) { /* allocate the FILE specific struct */ - conn->data->req.protop = calloc(1, sizeof(struct FILEPROTO)); - if(!conn->data->req.protop) + conn->data->req.p.file = calloc(1, sizeof(struct FILEPROTO)); + if(!conn->data->req.p.file) return CURLE_OUT_OF_MEMORY; return CURLE_OK; @@ -135,7 +135,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) { struct Curl_easy *data = conn->data; char *real_path; - struct FILEPROTO *file = data->req.protop; + struct FILEPROTO *file = data->req.p.file; int fd; #ifdef DOS_FILESYSTEM size_t i; @@ -209,7 +209,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) static CURLcode file_done(struct connectdata *conn, CURLcode status, bool premature) { - struct FILEPROTO *file = conn->data->req.protop; + struct FILEPROTO *file = conn->data->req.p.file; (void)status; /* not used */ (void)premature; /* not used */ @@ -227,18 +227,8 @@ static CURLcode file_done(struct connectdata *conn, static CURLcode file_disconnect(struct connectdata *conn, bool dead_connection) { - struct FILEPROTO *file = conn->data->req.protop; (void)dead_connection; /* not used */ - - if(file) { - Curl_safefree(file->freepath); - file->path = NULL; - if(file->fd != -1) - close(file->fd); - file->fd = -1; - } - - return CURLE_OK; + return file_done(conn, 0, 0); } #ifdef DOS_FILESYSTEM @@ -249,7 +239,7 @@ static CURLcode file_disconnect(struct connectdata *conn, static CURLcode file_upload(struct connectdata *conn) { - struct FILEPROTO *file = conn->data->req.protop; + struct FILEPROTO *file = conn->data->req.p.file; const char *dir = strchr(file->path, DIRSEP); int fd; int mode; @@ -391,7 +381,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done) if(data->set.upload) return file_upload(conn); - file = conn->data->req.protop; + file = conn->data->req.p.file; /* get the fd from the connection phase */ fd = file->fd; |