# HG changeset patch # User bertrand # Date 990799038 0 # Node ID e350849ff400b22e7972be3c86e4027d03a990df # Parent 5999c2c915005c41feaefcb6c09a0458c7ef8efa Url given without a filename/path get the filename/path '/' diff -r 5999c2c91500 -r e350849ff400 url.c --- a/url.c Fri May 25 06:12:37 2001 +0000 +++ b/url.c Fri May 25 13:57:18 2001 +0000 @@ -78,13 +78,23 @@ // check if it's not a trailing '/' if( strlen(ptr2)>1 ) { // copy the path/filename in the URL container - Curl->file = (char*)malloc(strlen(ptr2)); + Curl->file = (char*)malloc(strlen(ptr2)+1); if( Curl->file==NULL ) { printf("Memory allocation failed!\n"); exit(1); } - strcpy(Curl->file, ptr2+1); + Curl->file[0]='/'; + strcpy(Curl->file+1, ptr2+1); } + } + // Check if a filenme was given or set else set it with '/' + if( Curl->file==NULL ) { + Curl->file = (char*)malloc(2); + if( Curl->file==NULL ) { + printf("Memory allocation failed!\n"); + exit(1); + } + strcpy(Curl->file, "/"); } return Curl;