aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tftp.c10
-rw-r--r--tests/data/Makefile.am2
-rw-r--r--tests/data/test123849
3 files changed, 60 insertions, 1 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index b582ab319..f1ffd2a3a 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -56,6 +56,7 @@
#include "multiif.h"
#include "url.h"
#include "rawstr.h"
+#include "speedcheck.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -1255,6 +1256,15 @@ static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)
if(*dophase_done) {
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;
}
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index d9957f030..e0007f406 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -94,7 +94,7 @@ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
test1216 test1217 test1218 test1219 \
test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \
test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \
-test1236 test1237 \
+test1236 test1237 test1238 \
\
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
diff --git a/tests/data/test1238 b/tests/data/test1238
new file mode 100644
index 000000000..18593398a
--- /dev/null
+++ b/tests/data/test1238
@@ -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>