summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-03-12 14:20:16 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-03-12 14:20:16 +0000
commit571ceeff908bff65365dd8b4d40bfa0a3ad03867 (patch)
tree3018b8b83b1acafe2fac97e814e69f6b1cc3870a /src
parent34c4ba4321f6b7b04c43c6164f76a66c6ef090b0 (diff)
downloadcurl-571ceeff908bff65365dd8b4d40bfa0a3ad03867.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/main.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/main.c b/src/main.c
index 4e6f8aed4..e5e6d540a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2657,19 +2657,28 @@ operate(struct Configurable *config, int argc, char *argv[])
else
filep = config->infile;
- urlbuffer=(char *)malloc(strlen(url) + strlen(filep) + 3);
- if(!urlbuffer) {
- helpf("out of memory\n");
- return CURLE_OUT_OF_MEMORY;
+ /* URL encode the file name */
+ filep = curl_escape(filep, 0 /* use strlen */);
+
+ 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?? Only FIXED, VAR etc WITHOUT implied CC will work */