diff options
author | Curl Upstream <curl-library@cool.haxx.se> | 2020-12-09 06:38:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-09 16:45:09 (GMT) |
commit | 5aacc593a961fe9ee1427c03d18fba8947a9e33d (patch) | |
tree | 1eb7234820ce18ece5ae773015217f8135c9c08e /lib/file.c | |
parent | 7ceb56989f8ab3a4e1b1f2c48c9a0f382b85ec04 (diff) | |
download | CMake-5aacc593a961fe9ee1427c03d18fba8947a9e33d.zip CMake-5aacc593a961fe9ee1427c03d18fba8947a9e33d.tar.gz CMake-5aacc593a961fe9ee1427c03d18fba8947a9e33d.tar.bz2 |
curl 2020-12-09 (e0528597)
Code extracted from:
https://github.com/curl/curl.git
at commit e052859759b34d0e05ce0f17244873e5cd7b457b (curl-7_74_0).
Diffstat (limited to 'lib/file.c')
-rw-r--r-- | lib/file.c | 30 |
1 files changed, 10 insertions, 20 deletions
@@ -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; |