}
else {
file = fopen(p, "rb");
- if(!file)
- warnf(global,
- "Couldn't read data from file \"%s\", this makes "
- "an empty POST.", nextarg);
+ if(!file) {
+ errorf(global, "Failed to open %s", p);
+ return PARAM_READ_ERROR;
+ }
}
err = file2memory(&postdata, &size, file);
}
else {
file = fopen(nextarg, "rb");
- if(!file)
- warnf(global, "Couldn't read data from file \"%s\", this makes "
- "an empty POST.", nextarg);
+ if(!file) {
+ errorf(global, "Failed to open %s", nextarg);
+ err = PARAM_READ_ERROR;
+ break;
+ }
}
if((subletter == 'b') || /* --data-binary */
size_t len;
bool use_stdin = !strcmp(&nextarg[1], "-");
FILE *file = use_stdin?stdin:fopen(&nextarg[1], FOPEN_READTEXT);
- if(!file)
- warnf(global, "Failed to open %s", &nextarg[1]);
+ if(!file) {
+ errorf(global, "Failed to open %s", &nextarg[1]);
+ err = PARAM_READ_ERROR;
+ break;
+ }
else {
err = file2memory(&string, &len, file);
if(!err && string) {
}
else {
fname = nextarg;
- file = fopen(nextarg, FOPEN_READTEXT);
+ file = fopen(fname, FOPEN_READTEXT);
+ if(!file) {
+ errorf(global, "Failed to open %s", fname);
+ err = PARAM_READ_ERROR;
+ break;
+ }
}
Curl_safefree(config->writeout);
err = file2string(&config->writeout, file);
file = stdin;
else {
file = fopen(line, "rb");
+ if(!file) {
+ errorf(global, "Failed to open %s", line);
+ return PARAM_READ_ERROR;
+ }
}
- if(file) {
- err = file2memory(&content, &clen, file);
- /* in case of out of memory, this should fail the entire operation */
- contalloc = TRUE;
- }
+ err = file2memory(&content, &clen, file);
+ /* in case of out of memory, this should fail the entire operation */
+ contalloc = TRUE;
if(!use_stdin)
fclose(file);
if(err)
test235 test236 test237 test238 test239 test240 test241 test242 test243 \
test244 test245 test246 test247 test248 test249 test250 test251 test252 \
test253 test254 test255 test256 test257 test258 test259 test260 test261 \
-test262 test263 test264 test265 test266 test267 test268 test269 test270 \
+test262 test263 test264 test265 test266 test267 test269 test270 \
test271 test272 test273 test274 test275 test276 test277 test278 test279 \
test280 test281 test282 test283 test284 test285 test286 test287 test288 \
test289 test290 test291 test292 test293 test294 test295 test296 test297 \
+++ /dev/null
-<testcase>
-<info>
-<keywords>
-HTTP
-HTTP POST
-</keywords>
-</info>
-#
-# Server-side
-<reply>
-<data>
-HTTP/1.0 200 OK\r
-Server: test-server/fake\r
-Content-Type: text/html\r
-Content-Length: 0\r
-\r
-this is data even though Content-Length is set to zero
-</data>
-<datacheck>
-HTTP/1.0 200 OK\r
-Server: test-server/fake\r
-Content-Type: text/html\r
-Content-Length: 0\r
-\r
-</datacheck>
-</reply>
-
-#
-# Client-side
-<client>
-<server>
-http
-</server>
- <name>
-HTTP POST a non-existing file
- </name>
- <command>
- -d @nonesuchfile http://%HOSTIP:%HTTPPORT/%TESTNUMBER
-</command>
-</client>
-
-#
-# Verify data after the test has been "shot"
-<verify>
-<protocol>
-POST /%TESTNUMBER HTTP/1.1\r
-Host: %HOSTIP:%HTTPPORT\r
-User-Agent: curl/%VERSION\r
-Accept: */*\r
-Content-Length: 0\r
-Content-Type: application/x-www-form-urlencoded\r
-\r
-</protocol>
-</verify>
-</testcase>