aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-10-16 01:07:29 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-10-16 01:09:56 +0200
commit840eff44f2bea71acaa2a227998a97d01aacdc1f (patch)
tree2f0eddc19f513a85c8077b247ca090a548fccfd3 /tests/libtest
parentff03ee2a3c958065ad5fec657963deefb9b37ac0 (diff)
formdata: ack read callback abort
When doing a multipart formpost with a read callback, and that callback returns CURL_READFUNC_ABORT, that return code must be properly propagated back and handled accordingly. Previously it would be handled as a zero byte read which would cause a hang! Added test case 587 to verify. It uses the lib554.c source code with a small ifdef. Reported by: Anton Bychkov Bug: http://curl.haxx.se/mail/lib-2011-10/0097.html
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/Makefile.inc5
-rw-r--r--tests/libtest/lib554.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index a6f83134c..30883d227 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -15,7 +15,7 @@ noinst_PROGRAMS = chkhostname \
lib579 lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 \
lib543 lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 \
lib556 lib539 lib557 lib560 lib562 lib564 lib565 lib566 lib567 lib568 \
- lib569 lib570 lib571 lib572 lib573 lib582 lib583 lib585
+ lib569 lib570 lib571 lib572 lib573 lib582 lib583 lib585 lib587
chkhostname_SOURCES = chkhostname.c $(top_srcdir)/lib/curl_gethostname.c
chkhostname_LDADD = @CURL_NETWORK_LIBS@
@@ -166,3 +166,6 @@ lib583_SOURCES = lib583.c $(SUPPORTFILES)
lib585_SOURCES = lib500.c $(SUPPORTFILES)
lib585_CPPFLAGS = $(AM_CPPFLAGS) -DLIB585
+
+lib587_SOURCES = lib554.c $(SUPPORTFILES)
+lib587_CPPFLAGS = $(AM_CPPFLAGS) -DLIB587
diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c
index 8e71c8899..ba42bc482 100644
--- a/tests/libtest/lib554.c
+++ b/tests/libtest/lib554.c
@@ -42,6 +42,14 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
{
struct WriteThis *pooh = (struct WriteThis *)userp;
+#ifdef LIB587
+ (void)ptr;
+ (void)size;
+ (void)nmemb;
+ (void)userp;
+ return CURL_READFUNC_ABORT;
+#else
+
if(size*nmemb < 1)
return 0;
@@ -53,6 +61,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
}
return 0; /* no more data left to deliver */
+#endif
}
int test(char *URL)