Blame SOURCES/0012-curl-7.29.0-c639d725.patch

3a27f0
From 9b675516d5fb09a455d1f7b7aa98e253361bedf3 Mon Sep 17 00:00:00 2001
3a27f0
From: Daniel Stenberg <daniel@haxx.se>
3a27f0
Date: Fri, 8 Feb 2013 13:48:56 +0100
3a27f0
Subject: [PATCH 1/2] DONE: consider callback-aborted transfers premature
3a27f0
3a27f0
This bug report properly identified that when doing SMTP and aborting
3a27f0
the transfer with a callback, it must be considered aborted prematurely
3a27f0
by the code to avoid QUIT etc to be attempted as that would cause a
3a27f0
hang.
3a27f0
3a27f0
The new test case 1507 verifies this behavior.
3a27f0
3a27f0
Reported by: Patricia Muscalu
3a27f0
Bug: http://curl.haxx.se/bug/view.cgi?id=1184
3a27f0
3a27f0
[upstream commit 72688317adcedb9508fd2189e6c6d3945e06a004]
3a27f0
3a27f0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
3a27f0
---
3a27f0
 lib/url.c                  |    7 ++
3a27f0
 tests/data/Makefile.am     |    3 +-
3a27f0
 tests/data/Makefile.in     |    3 +-
3a27f0
 tests/data/test1507        |   51 +++++++++++++
3a27f0
 tests/libtest/Makefile.in  |   82 +++++++++++++++++++++-
3a27f0
 tests/libtest/Makefile.inc |    6 ++-
3a27f0
 tests/libtest/lib1507.c    |  167 ++++++++++++++++++++++++++++++++++++++++++++
3a27f0
 7 files changed, 313 insertions(+), 6 deletions(-)
3a27f0
 create mode 100644 tests/data/test1507
3a27f0
 create mode 100644 tests/libtest/lib1507.c
3a27f0
3a27f0
diff --git a/lib/url.c b/lib/url.c
3a27f0
index 52f7e27..a6375a2 100644
3a27f0
--- a/lib/url.c
3a27f0
+++ b/lib/url.c
3a27f0
@@ -5222,6 +5222,13 @@ CURLcode Curl_done(struct connectdata **connp,
3a27f0
     conn->dns_entry = NULL;
3a27f0
   }
3a27f0
 
3a27f0
+  if(status == CURLE_ABORTED_BY_CALLBACK)
3a27f0
+    /* When we're aborted due to a callback return code it basically have to
3a27f0
+       be counted as premature as there is trouble ahead if we don't. We have
3a27f0
+       many callbacks and protocols work differently, we could potentially do
3a27f0
+       this more fine-grained in the future. */
3a27f0
+    premature = TRUE;
3a27f0
+
3a27f0
   /* this calls the protocol-specific function pointer previously set */
3a27f0
   if(conn->handler->done)
3a27f0
     result = conn->handler->done(conn, status, premature);
3a27f0
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
3a27f0
index 3f6a047..805955c 100644
3a27f0
--- a/tests/data/Makefile.am
3a27f0
+++ b/tests/data/Makefile.am
3a27f0
@@ -93,7 +93,8 @@ test1379 test1380 test1381 test1382 test1383 test1384 test1385 test1386 \
3a27f0
 test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
3a27f0
 test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
3a27f0
 test1408 test1409 test1410 test1411 test1412 test1413 \
3a27f0
-test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1508 \
3a27f0
+test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
3a27f0
+test1508 \
3a27f0
 test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
3a27f0
 test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \
3a27f0
 test2016 test2017 test2018 test2019 test2020 test2021 test2022 \
3a27f0
diff --git a/tests/data/Makefile.in b/tests/data/Makefile.in
3a27f0
index 71c9422..1e6d679 100644
3a27f0
--- a/tests/data/Makefile.in
3a27f0
+++ b/tests/data/Makefile.in
3a27f0
@@ -357,7 +357,8 @@ test1379 test1380 test1381 test1382 test1383 test1384 test1385 test1386 \
3a27f0
 test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
3a27f0
 test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
3a27f0
 test1408 test1409 test1410 test1411 test1412 test1413 \
3a27f0
-test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1508 \
3a27f0
+test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
3a27f0
+test1508 \
3a27f0
 test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
3a27f0
 test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \
3a27f0
 test2016 test2017 test2018 test2019 test2020 test2021 test2022 \
3a27f0
diff --git a/tests/data/test1507 b/tests/data/test1507
3a27f0
new file mode 100644
3a27f0
index 0000000..b66e71d
3a27f0
--- /dev/null
3a27f0
+++ b/tests/data/test1507
3a27f0
@@ -0,0 +1,51 @@
3a27f0
+<testcase>
3a27f0
+<info>
3a27f0
+<keywords>
3a27f0
+SMTP
3a27f0
+multi
3a27f0
+</keywords>
3a27f0
+</info>
3a27f0
+
3a27f0
+#
3a27f0
+# Server-side
3a27f0
+<reply>
3a27f0
+</reply>
3a27f0
+
3a27f0
+#
3a27f0
+# Client-side
3a27f0
+<client>
3a27f0
+<server>
3a27f0
+smtp
3a27f0
+</server>
3a27f0
+<tool>
3a27f0
+lib1507
3a27f0
+</tool>
3a27f0
+
3a27f0
+# based on bug report #1184
3a27f0
+ <name>
3a27f0
+SMTP with multi interface and CURLE_ABORTED_BY_CALLBACK
3a27f0
+ </name>
3a27f0
+<stdin>
3a27f0
+From: different
3a27f0
+To: another
3a27f0
+
3a27f0
+body
3a27f0
+</stdin>
3a27f0
+ <command>
3a27f0
+smtp://%HOSTIP:%SMTPPORT/user
3a27f0
+</command>
3a27f0
+</client>
3a27f0
+
3a27f0
+#
3a27f0
+# Verify data after the test has been "shot"
3a27f0
+<verify>
3a27f0
+<protocol>
3a27f0
+EHLO user
3a27f0
+MAIL FROM:<1507-realuser@example.com>
3a27f0
+RCPT TO:<1507-recipient@example.com>
3a27f0
+DATA
3a27f0
+</protocol>
3a27f0
+<upload>
3a27f0
+</upload>
3a27f0
+</verify>
3a27f0
+</testcase>
3a27f0
diff --git a/tests/libtest/Makefile.in b/tests/libtest/Makefile.in
3a27f0
index 7683c09..e6826c0 100644
3a27f0
--- a/tests/libtest/Makefile.in
3a27f0
+++ b/tests/libtest/Makefile.in
3a27f0
@@ -85,7 +85,8 @@ noinst_PROGRAMS = chkhostname$(EXEEXT) libauthretry$(EXEEXT) \
3a27f0
 	lib591$(EXEEXT) lib597$(EXEEXT) lib598$(EXEEXT) \
3a27f0
 	lib599$(EXEEXT) lib1500$(EXEEXT) lib1501$(EXEEXT) \
3a27f0
 	lib1502$(EXEEXT) lib1503$(EXEEXT) lib1504$(EXEEXT) \
3a27f0
-	lib1505$(EXEEXT) lib1506$(EXEEXT) lib1508$(EXEEXT)
3a27f0
+	lib1505$(EXEEXT) lib1506$(EXEEXT) lib1507$(EXEEXT) \
3a27f0
+	lib1508$(EXEEXT)
3a27f0
 subdir = tests/libtest
3a27f0
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
3a27f0
 am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \
3a27f0
@@ -173,6 +174,13 @@ am_lib1506_OBJECTS = lib1506-lib1506.$(OBJEXT) $(am__objects_18) \
3a27f0
 	$(am__objects_19) $(am__objects_20)
3a27f0
 lib1506_OBJECTS = $(am_lib1506_OBJECTS)
3a27f0
 lib1506_DEPENDENCIES = $(am__DEPENDENCIES_1)
3a27f0
+am__objects_154 = lib1507-first.$(OBJEXT)
3a27f0
+am__objects_155 = lib1507-testutil.$(OBJEXT)
3a27f0
+am__objects_156 = lib1507-warnless.$(OBJEXT)
3a27f0
+am_lib1507_OBJECTS = lib1507-lib1507.$(OBJEXT) $(am__objects_154) \
3a27f0
+	$(am__objects_155) $(am__objects_156)
3a27f0
+lib1507_OBJECTS = $(am_lib1507_OBJECTS)
3a27f0
+lib1507_DEPENDENCIES = $(am__DEPENDENCIES_1)
3a27f0
 am__objects_151 = lib1508-first.$(OBJEXT)
3a27f0
 am__objects_152 = lib1508-testutil.$(OBJEXT)
3a27f0
 am__objects_153 = lib1508-warnless.$(OBJEXT)
3a27f0
@@ -639,7 +647,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
3a27f0
 SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \
3a27f0
 	$(lib1500_SOURCES) $(lib1501_SOURCES) $(lib1502_SOURCES) \
3a27f0
 	$(lib1503_SOURCES) $(lib1504_SOURCES) $(lib1505_SOURCES) \
3a27f0
-	$(lib1506_SOURCES) $(lib1508_SOURCES) $(lib500_SOURCES) $(lib501_SOURCES) \
3a27f0
+	$(lib1506_SOURCES) $(lib1507_SOURCES) $(lib1508_SOURCES) \
3a27f0
+	$(lib500_SOURCES) $(lib501_SOURCES) \
3a27f0
 	$(lib502_SOURCES) $(lib503_SOURCES) $(lib504_SOURCES) \
3a27f0
 	$(lib505_SOURCES) $(lib506_SOURCES) $(lib507_SOURCES) \
3a27f0
 	$(lib508_SOURCES) $(lib510_SOURCES) $(lib511_SOURCES) \
3a27f0
@@ -669,7 +678,8 @@ SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \
3a27f0
 DIST_SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \
3a27f0
 	$(lib1500_SOURCES) $(lib1501_SOURCES) $(lib1502_SOURCES) \
3a27f0
 	$(lib1503_SOURCES) $(lib1504_SOURCES) $(lib1505_SOURCES) \
3a27f0
-	$(lib1506_SOURCES) $(lib1508_SOURCES) $(lib500_SOURCES) $(lib501_SOURCES)  \
3a27f0
+	$(lib1506_SOURCES) $(lib1507_SOURCES) $(lib1508_SOURCES) \
3a27f0
+	$(lib500_SOURCES) $(lib501_SOURCES)  \
3a27f0
 	$(lib502_SOURCES) $(lib503_SOURCES) $(lib504_SOURCES) \
3a27f0
 	$(lib505_SOURCES) $(lib506_SOURCES) $(lib507_SOURCES) \
3a27f0
 	$(lib508_SOURCES) $(lib510_SOURCES) $(lib511_SOURCES) \
3a27f0
@@ -1162,6 +1172,9 @@ lib1505_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1505
3a27f0
 lib1506_SOURCES = lib1506.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
 lib1506_LDADD = $(TESTUTIL_LIBS)
3a27f0
 lib1506_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1506
3a27f0
+lib1507_SOURCES = lib1507.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
+lib1507_LDADD = $(TESTUTIL_LIBS)
3a27f0
+lib1507_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1507
3a27f0
 lib1508_SOURCES = lib1508.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
 lib1508_LDADD = $(TESTUTIL_LIBS)
3a27f0
 lib1508_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1508
3a27f0
@@ -1263,6 +1276,9 @@ lib1505$(EXEEXT): $(lib1505_OBJECTS) $(lib1505_DEPENDENCIES) $(EXTRA_lib1505_DEP
3a27f0
 lib1506$(EXEEXT): $(lib1506_OBJECTS) $(lib1506_DEPENDENCIES) $(EXTRA_lib1506_DEPENDENCIES) 
3a27f0
 	@rm -f lib1506$(EXEEXT)
3a27f0
 	$(LINK) $(lib1506_OBJECTS) $(lib1506_LDADD) $(LIBS)
3a27f0
+lib1507$(EXEEXT): $(lib1507_OBJECTS) $(lib1507_DEPENDENCIES) $(EXTRA_lib1507_DEPENDENCIES) 
3a27f0
+	@rm -f lib1507$(EXEEXT)
3a27f0
+	$(LINK) $(lib1507_OBJECTS) $(lib1507_LDADD) $(LIBS)
3a27f0
 lib1508$(EXEEXT): $(lib1508_OBJECTS) $(lib1508_DEPENDENCIES) $(EXTRA_lib1508_DEPENDENCIES) 
3a27f0
 	@rm -f lib1508$(EXEEXT)
3a27f0
 	$(LINK) $(lib1508_OBJECTS) $(lib1508_LDADD) $(LIBS)
3a27f0
@@ -1533,6 +1549,10 @@ distclean-compile:
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1506-lib1506.Po@am__quote@
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1506-testutil.Po@am__quote@
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1506-warnless.Po@am__quote@
3a27f0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1507-first.Po@am__quote@
3a27f0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1507-lib1507.Po@am__quote@
3a27f0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1507-testutil.Po@am__quote@
3a27f0
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1507-warnless.Po@am__quote@
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1508-first.Po@am__quote@
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1508-lib1508.Po@am__quote@
3a27f0
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1508-testutil.Po@am__quote@
3a27f0
@@ -2180,6 +2200,62 @@ lib1506-warnless.obj: ../../lib/warnless.c
3a27f0
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1506_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1506-warnless.obj `if test -f '../../lib/warnless.c'; then $(CYGPATH_W) '../../lib/warnless.c'; else $(CYGPATH_W) '$(srcdir)/../../lib/warnless.c'; fi`
3a27f0
 
3a27f0
+lib1507-lib1507.o: lib1507.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-lib1507.o -MD -MP -MF $(DEPDIR)/lib1507-lib1507.Tpo -c -o lib1507-lib1507.o `test -f 'lib1507.c' || echo '$(srcdir)/'`lib1507.c
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-lib1507.Tpo $(DEPDIR)/lib1507-lib1507.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='lib1507.c' object='lib1507-lib1507.o' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-lib1507.o `test -f 'lib1507.c' || echo '$(srcdir)/'`lib1507.c
3a27f0
+
3a27f0
+lib1507-lib1507.obj: lib1507.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-lib1507.obj -MD -MP -MF $(DEPDIR)/lib1507-lib1507.Tpo -c -o lib1507-lib1507.obj `if test -f 'lib1507.c'; then $(CYGPATH_W) 'lib1507.c'; else $(CYGPATH_W) '$(srcdir)/lib1507.c'; fi`
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-lib1507.Tpo $(DEPDIR)/lib1507-lib1507.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='lib1507.c' object='lib1507-lib1507.obj' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-lib1507.obj `if test -f 'lib1507.c'; then $(CYGPATH_W) 'lib1507.c'; else $(CYGPATH_W) '$(srcdir)/lib1507.c'; fi`
3a27f0
+
3a27f0
+lib1507-first.o: first.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-first.o -MD -MP -MF $(DEPDIR)/lib1507-first.Tpo -c -o lib1507-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-first.Tpo $(DEPDIR)/lib1507-first.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='first.c' object='lib1507-first.o' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c
3a27f0
+
3a27f0
+lib1507-first.obj: first.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-first.obj -MD -MP -MF $(DEPDIR)/lib1507-first.Tpo -c -o lib1507-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-first.Tpo $(DEPDIR)/lib1507-first.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='first.c' object='lib1507-first.obj' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`
3a27f0
+
3a27f0
+lib1507-testutil.o: testutil.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-testutil.o -MD -MP -MF $(DEPDIR)/lib1507-testutil.Tpo -c -o lib1507-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-testutil.Tpo $(DEPDIR)/lib1507-testutil.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='testutil.c' object='lib1507-testutil.o' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c
3a27f0
+
3a27f0
+lib1507-testutil.obj: testutil.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-testutil.obj -MD -MP -MF $(DEPDIR)/lib1507-testutil.Tpo -c -o lib1507-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-testutil.Tpo $(DEPDIR)/lib1507-testutil.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='testutil.c' object='lib1507-testutil.obj' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`
3a27f0
+
3a27f0
+lib1507-warnless.o: ../../lib/warnless.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-warnless.o -MD -MP -MF $(DEPDIR)/lib1507-warnless.Tpo -c -o lib1507-warnless.o `test -f '../../lib/warnless.c' || echo '$(srcdir)/'`../../lib/warnless.c
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-warnless.Tpo $(DEPDIR)/lib1507-warnless.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='../../lib/warnless.c' object='lib1507-warnless.o' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-warnless.o `test -f '../../lib/warnless.c' || echo '$(srcdir)/'`../../lib/warnless.c
3a27f0
+
3a27f0
+lib1507-warnless.obj: ../../lib/warnless.c
3a27f0
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1507-warnless.obj -MD -MP -MF $(DEPDIR)/lib1507-warnless.Tpo -c -o lib1507-warnless.obj `if test -f '../../lib/warnless.c'; then $(CYGPATH_W) '../../lib/warnless.c'; else $(CYGPATH_W) '$(srcdir)/../../lib/warnless.c'; fi`
3a27f0
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1507-warnless.Tpo $(DEPDIR)/lib1507-warnless.Po
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='../../lib/warnless.c' object='lib1507-warnless.obj' libtool=no @AMDEPBACKSLASH@
3a27f0
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3a27f0
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1507_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1507-warnless.obj `if test -f '../../lib/warnless.c'; then $(CYGPATH_W) '../../lib/warnless.c'; else $(CYGPATH_W) '$(srcdir)/../../lib/warnless.c'; fi`
3a27f0
+
3a27f0
 lib1508-lib1508.o: lib1508.c
3a27f0
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1508_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1508-lib1508.o -MD -MP -MF $(DEPDIR)/lib1508-lib1508.Tpo -c -o lib1508-lib1508.o `test -f 'lib1508.c' || echo '$(srcdir)/'`lib1508.c
3a27f0
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/lib1508-lib1508.Tpo $(DEPDIR)/lib1508-lib1508.Po
3a27f0
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
3a27f0
index 8bf2be4..5e377d3 100644
3a27f0
--- a/tests/libtest/Makefile.inc
3a27f0
+++ b/tests/libtest/Makefile.inc
3a27f0
@@ -23,7 +23,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
3a27f0
                 lib582 lib583        lib585 lib586 lib587               \
3a27f0
   lib590 lib591                                    lib597 lib598 lib599 \
3a27f0
   \
3a27f0
-  lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1508
3a27f0
+  lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508
3a27f0
 
3a27f0
 chkhostname_SOURCES = chkhostname.c ../../lib/curl_gethostname.c
3a27f0
 chkhostname_LDADD = @CURL_NETWORK_LIBS@
3a27f0
@@ -313,6 +313,10 @@ lib1506_SOURCES = lib1506.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
 lib1506_LDADD = $(TESTUTIL_LIBS)
3a27f0
 lib1506_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1506
3a27f0
 
3a27f0
+lib1507_SOURCES = lib1507.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
+lib1507_LDADD = $(TESTUTIL_LIBS)
3a27f0
+lib1507_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1507
3a27f0
+
3a27f0
 lib1508_SOURCES = lib1508.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
3a27f0
 lib1508_LDADD = $(TESTUTIL_LIBS)
3a27f0
 lib1508_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1508
3a27f0
diff --git a/tests/libtest/lib1507.c b/tests/libtest/lib1507.c
3a27f0
new file mode 100644
3a27f0
index 0000000..7c4e6ed
3a27f0
--- /dev/null
3a27f0
+++ b/tests/libtest/lib1507.c
3a27f0
@@ -0,0 +1,167 @@
3a27f0
+/***************************************************************************
3a27f0
+ *                                  _   _ ____  _
3a27f0
+ *  Project                     ___| | | |  _ \| |
3a27f0
+ *                             / __| | | | |_) | |
3a27f0
+ *                            | (__| |_| |  _ <| |___
3a27f0
+ *                             \___|\___/|_| \_\_____|
3a27f0
+ *
3a27f0
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
3a27f0
+ *
3a27f0
+ * This software is licensed as described in the file COPYING, which
3a27f0
+ * you should have received as part of this distribution. The terms
3a27f0
+ * are also available at http://curl.haxx.se/docs/copyright.html.
3a27f0
+ *
3a27f0
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3a27f0
+ * copies of the Software, and permit persons to whom the Software is
3a27f0
+ * furnished to do so, under the terms of the COPYING file.
3a27f0
+ *
3a27f0
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3a27f0
+ * KIND, either express or implied.
3a27f0
+ *
3a27f0
+ ***************************************************************************/
3a27f0
+#include "test.h"
3a27f0
+
3a27f0
+#include "testutil.h"
3a27f0
+#include "warnless.h"
3a27f0
+#include "memdebug.h"
3a27f0
+
3a27f0
+/*
3a27f0
+ * This is the list of basic details you need to tweak to get things right.
3a27f0
+ */
3a27f0
+#define USERNAME "user@example.com"
3a27f0
+#define PASSWORD "123qwerty"
3a27f0
+#define RECIPIENT "<1507-recipient@example.com>"
3a27f0
+#define MAILFROM "<1507-realuser@example.com>"
3a27f0
+
3a27f0
+#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
3a27f0
+
3a27f0
+static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
3a27f0
+{
3a27f0
+  (void)ptr;
3a27f0
+  (void)size;
3a27f0
+  (void)nmemb;
3a27f0
+  (void)userp;
3a27f0
+  return CURL_READFUNC_ABORT;
3a27f0
+}
3a27f0
+
3a27f0
+static struct timeval tvnow(void)
3a27f0
+{
3a27f0
+  /*
3a27f0
+  ** time() returns the value of time in seconds since the Epoch.
3a27f0
+  */
3a27f0
+  struct timeval now;
3a27f0
+  now.tv_sec = (long)time(NULL);
3a27f0
+  now.tv_usec = 0;
3a27f0
+  return now;
3a27f0
+}
3a27f0
+
3a27f0
+static long tvdiff(struct timeval newer, struct timeval older)
3a27f0
+{
3a27f0
+  return (newer.tv_sec-older.tv_sec)*1000+
3a27f0
+    (newer.tv_usec-older.tv_usec)/1000;
3a27f0
+}
3a27f0
+
3a27f0
+int test(char *URL)
3a27f0
+{
3a27f0
+   CURL *curl;
3a27f0
+   CURLM *mcurl;
3a27f0
+   int still_running = 1;
3a27f0
+   struct timeval mp_start;
3a27f0
+   struct curl_slist* rcpt_list = NULL;
3a27f0
+
3a27f0
+   curl_global_init(CURL_GLOBAL_DEFAULT);
3a27f0
+
3a27f0
+   curl = curl_easy_init();
3a27f0
+   if(!curl)
3a27f0
+     return 1;
3a27f0
+
3a27f0
+   mcurl = curl_multi_init();
3a27f0
+   if(!mcurl)
3a27f0
+     return 2;
3a27f0
+
3a27f0
+   rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
3a27f0
+   /* more addresses can be added here
3a27f0
+      rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
3a27f0
+   */
3a27f0
+
3a27f0
+   curl_easy_setopt(curl, CURLOPT_URL, URL);
3a27f0
+#if 0
3a27f0
+   curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
3a27f0
+   curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
3a27f0
+#endif
3a27f0
+   curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
3a27f0
+   curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
3a27f0
+   curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
3a27f0
+   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
3a27f0
+   curl_multi_add_handle(mcurl, curl);
3a27f0
+
3a27f0
+   mp_start = tvnow();
3a27f0
+
3a27f0
+  /* we start some action by calling perform right away */
3a27f0
+  curl_multi_perform(mcurl, &still_running);
3a27f0
+
3a27f0
+  while(still_running) {
3a27f0
+    struct timeval timeout;
3a27f0
+    int rc; /* select() return code */
3a27f0
+
3a27f0
+    fd_set fdread;
3a27f0
+    fd_set fdwrite;
3a27f0
+    fd_set fdexcep;
3a27f0
+    int maxfd = -1;
3a27f0
+
3a27f0
+    long curl_timeo = -1;
3a27f0
+
3a27f0
+    FD_ZERO(&fdread);
3a27f0
+    FD_ZERO(&fdwrite);
3a27f0
+    FD_ZERO(&fdexcep);
3a27f0
+
3a27f0
+    /* set a suitable timeout to play around with */
3a27f0
+    timeout.tv_sec = 1;
3a27f0
+    timeout.tv_usec = 0;
3a27f0
+
3a27f0
+    curl_multi_timeout(mcurl, &curl_timeo);
3a27f0
+    if(curl_timeo >= 0) {
3a27f0
+      timeout.tv_sec = curl_timeo / 1000;
3a27f0
+      if(timeout.tv_sec > 1)
3a27f0
+        timeout.tv_sec = 1;
3a27f0
+      else
3a27f0
+        timeout.tv_usec = (curl_timeo % 1000) * 1000;
3a27f0
+    }
3a27f0
+
3a27f0
+    /* get file descriptors from the transfers */
3a27f0
+    curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
3a27f0
+
3a27f0
+    /* In a real-world program you OF COURSE check the return code of the
3a27f0
+       function calls.  On success, the value of maxfd is guaranteed to be
3a27f0
+       greater or equal than -1.  We call select(maxfd + 1, ...), specially in
3a27f0
+       case of (maxfd == -1), we call select(0, ...), which is basically equal
3a27f0
+       to sleep. */
3a27f0
+
3a27f0
+    rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
3a27f0
+
3a27f0
+    if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
3a27f0
+      fprintf(stderr, "ABORTING TEST, since it seems "
3a27f0
+              "that it would have run forever.\n");
3a27f0
+      break;
3a27f0
+    }
3a27f0
+
3a27f0
+    switch(rc) {
3a27f0
+    case -1:
3a27f0
+      /* select error */
3a27f0
+      break;
3a27f0
+    case 0: /* timeout */
3a27f0
+    default: /* action */
3a27f0
+      curl_multi_perform(mcurl, &still_running);
3a27f0
+      break;
3a27f0
+    }
3a27f0
+  }
3a27f0
+
3a27f0
+  curl_slist_free_all(rcpt_list);
3a27f0
+  curl_multi_remove_handle(mcurl, curl);
3a27f0
+  curl_multi_cleanup(mcurl);
3a27f0
+  curl_easy_cleanup(curl);
3a27f0
+  curl_global_cleanup();
3a27f0
+  return 0;
3a27f0
+}
3a27f0
+
3a27f0
+
3a27f0
-- 
3a27f0
1.7.1
3a27f0
3a27f0
3a27f0
From 55004df420d1e520d84fded41a4d16f36acee119 Mon Sep 17 00:00:00 2001
3a27f0
From: Kamil Dudka <kdudka@redhat.com>
3a27f0
Date: Mon, 9 Sep 2013 13:10:53 +0200
3a27f0
Subject: [PATCH 2/2] url: handle abortion by read/write callbacks, too
3a27f0
3a27f0
Otherwise, the FTP protocol would unnecessarily hang 60 seconds if
3a27f0
aborted in the CURLOPT_HEADERFUNCTION callback.
3a27f0
3a27f0
Reported by: Tomas Mlcoch
3a27f0
Bug: https://bugzilla.redhat.com/1005686
3a27f0
3a27f0
[upstream commit c639d725a37c91fb49bb3a689cb2596fad3a0645]
3a27f0
---
3a27f0
 lib/url.c |    8 +++++++-
3a27f0
 1 files changed, 7 insertions(+), 1 deletions(-)
3a27f0
3a27f0
diff --git a/lib/url.c b/lib/url.c
3a27f0
index a6375a2..bddbd91 100644
3a27f0
--- a/lib/url.c
3a27f0
+++ b/lib/url.c
3a27f0
@@ -5222,12 +5222,18 @@ CURLcode Curl_done(struct connectdata **connp,
3a27f0
     conn->dns_entry = NULL;
3a27f0
   }
3a27f0
 
3a27f0
-  if(status == CURLE_ABORTED_BY_CALLBACK)
3a27f0
+  switch(status) {
3a27f0
+  case CURLE_ABORTED_BY_CALLBACK:
3a27f0
+  case CURLE_READ_ERROR:
3a27f0
+  case CURLE_WRITE_ERROR:
3a27f0
     /* When we're aborted due to a callback return code it basically have to
3a27f0
        be counted as premature as there is trouble ahead if we don't. We have
3a27f0
        many callbacks and protocols work differently, we could potentially do
3a27f0
        this more fine-grained in the future. */
3a27f0
     premature = TRUE;
3a27f0
+  default:
3a27f0
+    break;
3a27f0
+  }
3a27f0
 
3a27f0
   /* this calls the protocol-specific function pointer previously set */
3a27f0
   if(conn->handler->done)
3a27f0
-- 
3a27f0
1.7.1
3a27f0