When we append stuff to the URL, we must make sure the text is properly
URL encoded before. Test case 58 added to verify this.
This commit is contained in:
parent
34c4ba4321
commit
571ceeff90
33
src/main.c
33
src/main.c
@ -2657,19 +2657,28 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
filep = config->infile;
|
filep = config->infile;
|
||||||
|
|
||||||
urlbuffer=(char *)malloc(strlen(url) + strlen(filep) + 3);
|
/* URL encode the file name */
|
||||||
if(!urlbuffer) {
|
filep = curl_escape(filep, 0 /* use strlen */);
|
||||||
helpf("out of memory\n");
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
if(filep) {
|
||||||
|
|
||||||
|
urlbuffer=(char *)malloc(strlen(url) + strlen(filep) + 3);
|
||||||
|
if(!urlbuffer) {
|
||||||
|
helpf("out of memory\n");
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
if(ptr)
|
||||||
|
/* there is a trailing slash on the URL */
|
||||||
|
sprintf(urlbuffer, "%s%s", url, filep);
|
||||||
|
else
|
||||||
|
/* thers is no trailing slash on the URL */
|
||||||
|
sprintf(urlbuffer, "%s/%s", url, filep);
|
||||||
|
|
||||||
|
curl_free(filep);
|
||||||
|
|
||||||
|
free(url);
|
||||||
|
url = urlbuffer; /* use our new URL instead! */
|
||||||
}
|
}
|
||||||
if(ptr)
|
|
||||||
/* there is a trailing slash on the URL */
|
|
||||||
sprintf(urlbuffer, "%s%s", url, filep);
|
|
||||||
else
|
|
||||||
/* thers is no trailing slash on the URL */
|
|
||||||
sprintf(urlbuffer, "%s/%s", url, filep);
|
|
||||||
|
|
||||||
url = urlbuffer; /* use our new URL instead! */
|
|
||||||
}
|
}
|
||||||
/*VMS??-- Reading binary from files can be a problem... */
|
/*VMS??-- Reading binary from files can be a problem... */
|
||||||
/*VMS?? Only FIXED, VAR etc WITHOUT implied CC will work */
|
/*VMS?? Only FIXED, VAR etc WITHOUT implied CC will work */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user