CURLOPT_OPENSOCKETFUNCTION: return error at once

When CURL_SOCKET_BAD is returned in the callback, it should be treated
as an error (CURLE_COULDNT_CONNECT) if no other socket is subsequently
created when trying to connect to a server.

Bug: http://curl.haxx.se/mail/lib-2015-06/0047.html
This commit is contained in:
Daniel Stenberg
2015-06-09 00:22:02 +02:00
parent eaeeed2e8f
commit 20ac345806
5 changed files with 104 additions and 3 deletions

View File

@@ -153,7 +153,7 @@ test1516 \
\
test1520 \
\
test1525 test1526 test1527 test1528 test1529 \
test1525 test1526 test1527 test1528 test1529 test1530 \
\
test1600 test1601 test1602 \
\

27
tests/data/test1530 Normal file
View File

@@ -0,0 +1,27 @@
<testcase>
<info>
<keywords>
CURLOPT_OPENSOCKETFUNCTION
</keywords>
</info>
<client>
<server>
none
</server>
<tool>
lib1530
</tool>
<name>
CURLOPT_OPENSOCKETFUNCTION returns bad socket
</name>
</client>
# it should be detected and an error should be reported
<verify>
# 7 == CURLE_COULDNT_CONNECT
<errorcode>
7
</errorcode>
</verify>
</testcase>