"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/tool_operhlp.c" between
curl-7.65.3.tar.xz and curl-7.66.0.tar.xz

About: cURL is a powerful commandline tool to transfer data from or to a server, using one of the supported protocols HTTP(S), FTP(S), SCP, SFTP, TFTP, DICT, TELNET, LDAP(S) or FILE.

tool_operhlp.c  (curl-7.65.3.tar.xz):tool_operhlp.c  (curl-7.66.0.tar.xz)
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
* / __| | | | |_) | | * / __| | | | |_) | |
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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.haxx.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * 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 * copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file. * furnished to do so, under the terms of the COPYING file.
* *
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
skipping to change at line 74 skipping to change at line 74
bool stdin_upload(const char *uploadfile) bool stdin_upload(const char *uploadfile)
{ {
return (!strcmp(uploadfile, "-") || return (!strcmp(uploadfile, "-") ||
!strcmp(uploadfile, ".")) ? TRUE : FALSE; !strcmp(uploadfile, ".")) ? TRUE : FALSE;
} }
/* /*
* Adds the file name to the URL if it doesn't already have one. * Adds the file name to the URL if it doesn't already have one.
* url will be freed before return if the returned pointer is different * url will be freed before return if the returned pointer is different
*/ */
char *add_file_name_to_url(CURL *curl, char *url, const char *filename) char *add_file_name_to_url(char *url, const char *filename)
{ {
/* If no file name part is given in the URL, we add this file name */ /* If no file name part is given in the URL, we add this file name */
char *ptr = strstr(url, "://"); char *ptr = strstr(url, "://");
CURL *curl = curl_easy_init(); /* for url escaping */
if(!curl)
return NULL; /* error! */
if(ptr) if(ptr)
ptr += 3; ptr += 3;
else else
ptr = url; ptr = url;
ptr = strrchr(ptr, '/'); ptr = strrchr(ptr, '/');
if(!ptr || !strlen(++ptr)) { if(!ptr || !strlen(++ptr)) {
/* The URL has no file name part, add the local file name. In order /* The URL has no file name part, add the local file name. In order
to be able to do so, we have to create a new URL in another to be able to do so, we have to create a new URL in another
buffer.*/ buffer.*/
skipping to change at line 123 skipping to change at line 126
Curl_safefree(url); Curl_safefree(url);
if(!urlbuffer) if(!urlbuffer)
return NULL; return NULL;
url = urlbuffer; /* use our new URL instead! */ url = urlbuffer; /* use our new URL instead! */
} }
else else
Curl_safefree(url); Curl_safefree(url);
} }
curl_easy_cleanup(curl);
return url; return url;
} }
/* Extracts the name portion of the URL. /* Extracts the name portion of the URL.
* Returns a pointer to a heap-allocated string or NULL if * Returns a pointer to a heap-allocated string or NULL if
* no name part, at location indicated by first argument. * no name part, at location indicated by first argument.
*/ */
CURLcode get_url_file_name(char **filename, const char *url) CURLcode get_url_file_name(char **filename, const char *url)
{ {
const char *pc, *pc2; const char *pc, *pc2;
 End of changes. 4 change blocks. 
2 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)