TFTP: make the CURLOPT_LOW_SPEED* options work
... this also makes sure that the progess callback gets called more often during TFTP transfers. Added test 1238 to verify. Bug: http://curl.haxx.se/bug/view.cgi?id=1269 Reported-by: Jo3
This commit is contained in:
parent
06d1b10cbe
commit
4bea91fc67
10
lib/tftp.c
10
lib/tftp.c
@ -56,6 +56,7 @@
|
|||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
#include "rawstr.h"
|
||||||
|
#include "speedcheck.h"
|
||||||
|
|
||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
@ -1255,6 +1256,15 @@ static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)
|
|||||||
if(*dophase_done) {
|
if(*dophase_done) {
|
||||||
DEBUGF(infof(conn->data, "DO phase is complete\n"));
|
DEBUGF(infof(conn->data, "DO phase is complete\n"));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* The multi code doesn't have this logic for the DOING state so we
|
||||||
|
provide it for TFTP since it may do the entire transfer in this
|
||||||
|
state. */
|
||||||
|
if(Curl_pgrsUpdate(conn))
|
||||||
|
result = CURLE_ABORTED_BY_CALLBACK;
|
||||||
|
else
|
||||||
|
result = Curl_speedcheck(conn->data, Curl_tvnow());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
|
|||||||
test1216 test1217 test1218 test1219 \
|
test1216 test1217 test1218 test1219 \
|
||||||
test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \
|
test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \
|
||||||
test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \
|
test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \
|
||||||
test1236 test1237 \
|
test1236 test1237 test1238 \
|
||||||
\
|
\
|
||||||
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
|
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
|
||||||
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
|
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
|
||||||
|
49
tests/data/test1238
Normal file
49
tests/data/test1238
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
TFTP
|
||||||
|
TFTP RRQ
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<servercmd>
|
||||||
|
writedelay: 1
|
||||||
|
</servercmd>
|
||||||
|
# ~1200 bytes (so that they don't fit in two 512 byte chunks)
|
||||||
|
<data nocheck="yes">
|
||||||
|
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
tftp
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
slow TFTP retrieve cancel due to -Y and -y
|
||||||
|
</name>
|
||||||
|
# if less than 1000 bytes/sec within 2 seconds, abort!
|
||||||
|
<command>
|
||||||
|
tftp://%HOSTIP:%TFTPPORT//1238 -Y1000 -y2
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify pseudo protocol after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol>
|
||||||
|
opcode: 1
|
||||||
|
filename: /1238
|
||||||
|
mode: octet
|
||||||
|
</protocol>
|
||||||
|
# 28 = CURLE_OPERATION_TIMEDOUT
|
||||||
|
<errorcode>
|
||||||
|
28
|
||||||
|
</errorcode>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
Loading…
x
Reference in New Issue
Block a user