o curl -d @filename when 'filename' was not possible to access no longer

converts the request to a GET, but now instead makes it a POST of no data
o The time condition illegal syntax warning is now inhibited if -s is used.
This commit is contained in:
Daniel Stenberg 2005-08-12 21:25:44 +00:00
parent 162f58c53c
commit 639857ceb2
1 changed files with 12 additions and 4 deletions

View File

@ -1749,8 +1749,15 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
postdata = file2memory(file, &config->postfieldsize); postdata = file2memory(file, &config->postfieldsize);
else else
postdata = file2string(file); postdata = file2string(file);
if(file && (file != stdin)) if(file && (file != stdin))
fclose(file); fclose(file);
if(!postdata) {
/* no data from the file, point to a zero byte string to make this
get sent as a POST anyway */
postdata=strdup("");
}
} }
else { else {
GetStr(&postdata, nextarg); GetStr(&postdata, nextarg);
@ -2205,10 +2212,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
if(-1 == stat(nextarg, &statbuf)) { if(-1 == stat(nextarg, &statbuf)) {
/* failed, remove time condition */ /* failed, remove time condition */
config->timecond = CURL_TIMECOND_NONE; config->timecond = CURL_TIMECOND_NONE;
fprintf(stderr, if(!(config->conf & CONF_MUTE))
"Warning: Illegal date format for -z/--timecond and not " fprintf(stderr,
"a file name.\n" "Warning: Illegal date format for -z/--timecond and not "
" See curl_getdate(3) for valid date syntax.\n"); "a file name.\n"
" See curl_getdate(3) for valid date syntax.\n");
} }
else { else {
/* pull the time out from the file */ /* pull the time out from the file */