Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
3ad91bf9
Commit
3ad91bf9
authored
Jan 09, 2003
by
Andy Cedilnik
Browse files
New version of libcurl
parent
382d0d44
Changes
79
Expand all
Hide whitespace changes
Inline
Side-by-side
Source/CTest/Curl/CMakeLists.txt
View file @
3ad91bf9
...
...
@@ -2,7 +2,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 1.5)
PROJECT
(
LIBCURL C
)
SET
(
PACKAGE
"curl"
)
SET
(
VERSION
"7.9.5"
)
SET
(
VERSION
"7.10.2"
)
SET
(
PACKAGE_TARNAME
" "
)
SET
(
OPERATING_SYSTEM
${
CMAKE_SYSTEM_NAME
}
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_ANSI_CFLAGS
}
${
CMAKE_C_FLAGS
}
"
)
...
...
@@ -52,6 +53,7 @@ SET(libCurl_SRCS
llist.c
hash.c
multi.c
content_encoding.c
)
IF
(
WIN32
)
...
...
@@ -86,6 +88,11 @@ IF(HAVE_LIBWS2_32)
SET
(
CURL_LIBS
${
CURL_LIBS
}
ws2_32
)
ENDIF
(
HAVE_LIBWS2_32
)
CHECK_LIBRARY_EXISTS
(
"z;
${
CURL_LIBS
}
"
inflateEnd
""
HAVE_LIBZ
)
IF
(
HAVE_LIBZ
)
SET
(
CURL_LIBS
${
CURL_LIBS
}
z
)
ENDIF
(
HAVE_LIBZ
)
SET
(
CMAKE_REQUIRED_LIBRARIES
${
CURL_LIBS
}
)
CHECK_INCLUDE_FILE
(
"sys/types.h"
HAVE_SYS_TYPES_H
)
...
...
@@ -97,6 +104,8 @@ CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
CHECK_INCLUDE_FILE
(
"malloc.h"
HAVE_MALLOC_H
)
CHECK_INCLUDE_FILE
(
"memory.h"
HAVE_MEMORY_H
)
CHECK_INCLUDE_FILE
(
"netdb.h"
HAVE_NETDB_H
)
CHECK_INCLUDE_FILE
(
"zlib.h"
HAVE_ZLIB_H
)
CHECK_INCLUDE_FILE
(
"sys/poll.h"
HAVE_SYS_POLL_H
)
CHECK_INCLUDE_FILE
(
"netinet/in.h"
HAVE_NETINET_IN_H
)
CHECK_INCLUDE_FILE
(
"sys/socket.h"
HAVE_SYS_SOCKET_H
)
...
...
@@ -140,6 +149,7 @@ CHECK_INCLUDE_FILE("winsock.h" HAVE_WINSOCK_H)
CHECK_INCLUDE_FILE
(
"sockio.h"
HAVE_SOCKIO_H
)
CHECK_INCLUDE_FILE
(
"sys/sockio.h"
HAVE_SYS_SOCKIO_H
)
CHECK_INCLUDE_FILE
(
"x509.h"
HAVE_X509_H
)
CHECK_INCLUDE_FILE
(
"setjmp.h"
HAVE_SETJMP_H
)
CHECK_TYPE_SIZE
(
ssize_t SIZEOF_SSIZE_T
)
CHECK_TYPE_SIZE
(
"long double"
SIZEOF_LONG_DOUBLE
)
...
...
@@ -153,6 +163,7 @@ CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT)
CHECK_FUNCTION_EXISTS
(
vprintf HAVE_VPRINTF
)
CHECK_FUNCTION_EXISTS
(
socket HAVE_SOCKET
)
CHECK_FUNCTION_EXISTS
(
poll HAVE_POLL
)
CHECK_FUNCTION_EXISTS
(
select HAVE_SELECT
)
CHECK_FUNCTION_EXISTS
(
strdup HAVE_STRDUP
)
CHECK_FUNCTION_EXISTS
(
strstr HAVE_STRSTR
)
...
...
@@ -175,6 +186,12 @@ CHECK_FUNCTION_EXISTS(closesocket HAVE_CLOSESOCKET)
CHECK_FUNCTION_EXISTS
(
setvbuf HAVE_SETVBUF
)
CHECK_FUNCTION_EXISTS
(
sigaction HAVE_SIGACTION
)
CHECK_FUNCTION_EXISTS
(
signal HAVE_SIGNAL
)
CHECK_FUNCTION_EXISTS
(
sigsetjmp HAVE_SIGSETJMP
)
CHECK_FUNCTION_EXISTS
(
__sigsetjmp HAVE___SIGSETJMP
)
IF
(
HAVE___SIGSETJMP
)
SET
(
HAVE_SIGSETJMP 1
)
ENDIF
(
HAVE___SIGSETJMP
)
CHECK_FUNCTION_EXISTS
(
getpass_r HAVE_GETPASS_R
)
CHECK_FUNCTION_EXISTS
(
strlcat HAVE_STRLCAT
)
CHECK_FUNCTION_EXISTS
(
getpwuid HAVE_GETPWUID
)
...
...
Source/CTest/Curl/arpa_telnet.h
View file @
3ad91bf9
#ifndef __ARPA_TELNET_H
#define __ARPA_TELNET_H
/***************************************************************************
**
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************
**
/
***************************************************************************/
#ifndef CURL_DISABLE_TELNET
/*
* Telnet option defines. Add more here if in need.
*/
...
...
@@ -97,5 +97,5 @@ static const char *telnetcmds[]=
#define TELCMD_OK(x) ( ((unsigned int)(x) >= TELCMD_MINIMUM) && \
((unsigned int)(x) <= TELCMD_MAXIMUM) )
#define TELCMD(x) telnetcmds[(x)-TELCMD_MINIMUM]
#endif
#endif
Source/CTest/Curl/base64.c
View file @
3ad91bf9
/***************************************************************************
**
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Andrew Francis and Daniel Stenberg
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************
**
/
***************************************************************************/
/* Base64 encoding/decoding
*
...
...
Source/CTest/Curl/base64.h
View file @
3ad91bf9
#ifndef __BASE64_H
#define __BASE64_H
/***************************************************************************
**
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************
**
/
***************************************************************************/
int
Curl_base64_encode
(
const
void
*
data
,
int
size
,
char
**
str
);
int
Curl_base64_decode
(
const
char
*
str
,
void
*
data
);
#endif
Source/CTest/Curl/ca-bundle.h
0 → 100644
View file @
3ad91bf9
#ifndef __CA_BUNDLE_H
#define __CA_BUNDLE_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
*****************************************************************************/
#ifndef CURL_CA_BUNDLE
/* Set this to the full path file name of the ca cert bundle */
#undef CURL_CA_BUNDLE
#endif
#endif
/* __CA_BUNDLE_H */
Source/CTest/Curl/config.h.in
View file @
3ad91bf9
This diff is collapsed.
Click to expand it.
Source/CTest/Curl/connect.c
View file @
3ad91bf9
/***************************************************************************
**
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************
**
/
***************************************************************************/
#include
"setup.h"
...
...
@@ -185,7 +185,6 @@ int waitconnect(int sockfd, /* socket */
return
0
;
}
#ifndef ENABLE_IPV6
static
CURLcode
bindlocal
(
struct
connectdata
*
conn
,
int
sockfd
)
{
...
...
@@ -207,22 +206,28 @@ static CURLcode bindlocal(struct connectdata *conn,
*************************************************************/
if
(
strlen
(
data
->
set
.
device
)
<
255
)
{
struct
sockaddr_in
sa
;
struct
hostent
*
h
=
NULL
;
char
*
hostdataptr
=
NULL
;
struct
Curl_dns_entry
*
h
=
NULL
;
size_t
size
;
char
myhost
[
256
]
=
""
;
in_addr_t
in
;
if
(
Curl_if2ip
(
data
->
set
.
device
,
myhost
,
sizeof
(
myhost
)))
{
h
=
Curl_resolv
(
data
,
myhost
,
0
,
&
hostdataptr
);
/*
* We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer
*/
h
=
Curl_resolv
(
data
,
myhost
,
0
);
}
else
{
if
(
strlen
(
data
->
set
.
device
)
>
1
)
{
h
=
Curl_resolv
(
data
,
data
->
set
.
device
,
0
,
&
hostdataptr
);
}
if
(
h
)
{
/* we know data->set.device is shorter than the myhost array */
strcpy
(
myhost
,
data
->
set
.
device
);
/*
* This was not an interface, resolve the name as a host name
* or IP number
*/
h
=
Curl_resolv
(
data
,
data
->
set
.
device
,
0
);
if
(
h
)
{
/* we know data->set.device is shorter than the myhost array */
strcpy
(
myhost
,
data
->
set
.
device
);
}
}
}
...
...
@@ -242,11 +247,19 @@ static CURLcode bindlocal(struct connectdata *conn,
if
(
INADDR_NONE
!=
in
)
{
if
(
h
)
{
Curl_addrinfo
*
addr
=
h
->
addr
;
Curl_resolv_unlock
(
h
);
/* we don't need it anymore after this function has returned */
memset
((
char
*
)
&
sa
,
0
,
sizeof
(
sa
));
memcpy
((
char
*
)
&
sa
.
sin_addr
,
h
->
h_addr
,
h
->
h_length
);
#ifdef ENABLE_IPV6
memcpy
((
char
*
)
&
sa
.
sin_addr
,
addr
->
ai_addr
,
addr
->
ai_addrlen
);
sa
.
sin_family
=
addr
->
ai_family
;
#else
memcpy
((
char
*
)
&
sa
.
sin_addr
,
addr
->
h_addr
,
addr
->
h_length
);
sa
.
sin_family
=
AF_INET
;
#endif
sa
.
sin_addr
.
s_addr
=
in
;
sa
.
sin_port
=
0
;
/* get any port */
...
...
@@ -314,7 +327,7 @@ static CURLcode bindlocal(struct connectdata *conn,
return
CURLE_HTTP_PORT_FAILED
;
}
#endif
/* end of ipv4-specific section */
static
int
socketerror
(
int
sockfd
)
...
...
@@ -329,6 +342,72 @@ int socketerror(int sockfd)
return
err
;
}
/*
* Curl_is_connected() is used from the multi interface to check if the
* firstsocket has connected.
*/
CURLcode
Curl_is_connected
(
struct
connectdata
*
conn
,
int
sockfd
,
bool
*
connected
)
{
int
rc
;
struct
SessionHandle
*
data
=
conn
->
data
;
*
connected
=
FALSE
;
/* a very negative world view is best */
if
(
data
->
set
.
timeout
||
data
->
set
.
connecttimeout
)
{
/* there is a timeout set */
/* Evaluate in milliseconds how much time that has passed */
long
has_passed
=
Curl_tvdiff
(
Curl_tvnow
(),
data
->
progress
.
start
);
/* subtract the most strict timeout of the ones */
if
(
data
->
set
.
timeout
&&
data
->
set
.
connecttimeout
)
{
if
(
data
->
set
.
timeout
<
data
->
set
.
connecttimeout
)
has_passed
-=
data
->
set
.
timeout
*
1000
;
else
has_passed
-=
data
->
set
.
connecttimeout
*
1000
;
}
else
if
(
data
->
set
.
timeout
)
has_passed
-=
data
->
set
.
timeout
*
1000
;
else
has_passed
-=
data
->
set
.
connecttimeout
*
1000
;
if
(
has_passed
>
0
)
{
/* time-out, bail out, go home */
failf
(
data
,
"Connection time-out"
);
return
CURLE_OPERATION_TIMEOUTED
;
}
}
/* check for connect without timeout as we want to return immediately */
rc
=
waitconnect
(
sockfd
,
0
);
if
(
0
==
rc
)
{
int
err
=
socketerror
(
sockfd
);
if
((
0
==
err
)
||
(
EISCONN
==
err
))
{
/* we are connected, awesome! */
*
connected
=
TRUE
;
return
CURLE_OK
;
}
/* nope, not connected for real */
if
(
err
)
return
CURLE_COULDNT_CONNECT
;
}
/*
* If the connection phase is "done" here, we should attempt to connect
* to the "next address" in the Curl_hostaddr structure that we resolved
* before. But we don't have that struct around anymore and we can't just
* keep a pointer since the cache might in fact have gotten pruned by the
* time we want to read this... Alas, we don't do this yet.
*/
return
CURLE_OK
;
}
/*
* TCP connect to the given host with timeout, proxy or remote doesn't matter.
* There might be more than one IP address to try out. Fill in the passed
...
...
@@ -336,15 +415,17 @@ int socketerror(int sockfd)
*/
CURLcode
Curl_connecthost
(
struct
connectdata
*
conn
,
/* context */
Curl_addrinfo
*
remotehost
,
/* use
one in her
e */
struct
Curl_dns_entry
*
remotehost
,
/* use
this on
e */
int
port
,
/* connect to this */
int
*
sockconn
,
/* the connected socket */
Curl_ipconnect
**
addr
)
/* the one we used */
Curl_ipconnect
**
addr
,
/* the one we used */
bool
*
connected
)
/* really connected? */
{
struct
SessionHandle
*
data
=
conn
->
data
;
int
rc
;
int
sockfd
=-
1
;
int
aliasindex
=
0
;
char
*
hostname
;
struct
timeval
after
;
struct
timeval
before
=
Curl_tvnow
();
...
...
@@ -353,6 +434,9 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
* Figure out what maximum time we have left
*************************************************************/
long
timeout_ms
=
300000
;
/* milliseconds, default to five minutes */
*
connected
=
FALSE
;
/* default to not connected */
if
(
data
->
set
.
timeout
||
data
->
set
.
connecttimeout
)
{
double
has_passed
;
...
...
@@ -385,6 +469,13 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
}
}
hostname
=
data
->
change
.
proxy
?
conn
->
proxyhost
:
conn
->
hostname
;
infof
(
data
,
"About to connect() to %s%s%s:%d
\n
"
,
conn
->
bits
.
ipv6_ip
?
"["
:
""
,
hostname
,
conn
->
bits
.
ipv6_ip
?
"]"
:
""
,
port
);
#ifdef ENABLE_IPV6
/*
* Connecting with IPv6 support is so much easier and cleanly done
...
...
@@ -393,11 +484,19 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
struct
addrinfo
*
ai
;
port
=
0
;
/* prevent compiler warning */
for
(
ai
=
remotehost
;
ai
;
ai
=
ai
->
ai_next
,
aliasindex
++
)
{
for
(
ai
=
remotehost
->
addr
;
ai
;
ai
=
ai
->
ai_next
,
aliasindex
++
)
{
sockfd
=
socket
(
ai
->
ai_family
,
ai
->
ai_socktype
,
ai
->
ai_protocol
);
if
(
sockfd
<
0
)
continue
;
if
(
conn
->
data
->
set
.
device
)
{
/* user selected to bind the outgoing socket to a specified "device"
before doing connect */
CURLcode
res
=
bindlocal
(
conn
,
sockfd
);
if
(
res
)
return
res
;
}
/* set socket non-blocking */
Curl_nonblock
(
sockfd
,
TRUE
);
...
...
@@ -417,17 +516,21 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
case
EAGAIN
:
#endif
case
EINTR
:
/* asynchronous connect, wait for connect or timeout */
if
(
data
->
state
.
used_interface
==
Curl_if_multi
)
/* don't hang when doing multi */
timeout_ms
=
0
;
rc
=
waitconnect
(
sockfd
,
timeout_ms
);
break
;
case
ECONNREFUSED
:
/* no one listening */
default:
/* unknown error, fallthrough and try another address! */
failf
(
data
,
"Failed
to
connect
"
);
failf
(
data
,
"Failed connect
to %s: %d"
,
hostname
,
error
);
break
;
}
}
if
(
0
==
rc
)
{
/* we might be connected, if the socket says it is OK! Ask it! */
int
err
;
...
...
@@ -435,10 +538,17 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
err
=
socketerror
(
sockfd
);
if
((
0
==
err
)
||
(
EISCONN
==
err
))
{
/* we are connected, awesome! */
*
connected
=
TRUE
;
/* this is truly a connect */
break
;
}
failf
(
data
,
"socket error: %d"
,
err
);
/* we are _not_ connected, it was a false alert, continue please */
}
else
if
(
data
->
state
.
used_interface
==
Curl_if_multi
)
{
/* When running the multi interface, we bail out here */
rc
=
0
;
break
;
}
/* connect failed or timed out */
sclose
(
sockfd
);
...
...
@@ -454,10 +564,8 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
before
=
after
;
continue
;
}
if
(
sockfd
<
0
)
{
failf
(
data
,
"connect() failed"
);
if
(
sockfd
<
0
)
return
CURLE_COULDNT_CONNECT
;
}
/* leave the socket in non-blocking mode */
...
...
@@ -468,7 +576,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/*
* Connecting with IPv4-only support
*/
if
(
!
remotehost
->
h_addr_list
[
0
])
{
if
(
!
remotehost
->
addr
->
h_addr_list
[
0
])
{
/* If there is no addresses in the address list, then we return
error right away */
failf
(
data
,
"no address available"
);
...
...
@@ -495,17 +603,17 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/* This is the loop that attempts to connect to all IP-addresses we
know for the given host. One by one. */
for
(
rc
=-
1
,
aliasindex
=
0
;
rc
&&
(
struct
in_addr
*
)
remotehost
->
h_addr_list
[
aliasindex
];
rc
&&
(
struct
in_addr
*
)
remotehost
->
addr
->
h_addr_list
[
aliasindex
];
aliasindex
++
)
{
struct
sockaddr_in
serv_addr
;
/* do this nasty work to do the connect */
memset
((
char
*
)
&
serv_addr
,
'\0'
,
sizeof
(
serv_addr
));
memcpy
((
char
*
)
&
(
serv_addr
.
sin_addr
),
(
struct
in_addr
*
)
remotehost
->
h_addr_list
[
aliasindex
],
(
struct
in_addr
*
)
remotehost
->
addr
->
h_addr_list
[
aliasindex
],
sizeof
(
struct
in_addr
));
serv_addr
.
sin_family
=
remotehost
->
h_addrtype
;
serv_addr
.
sin_port
=
htons
(
port
);
serv_addr
.
sin_family
=
remotehost
->
addr
->
h_addrtype
;
serv_addr
.
sin_port
=
htons
(
(
unsigned
short
)
port
);
rc
=
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
));
...
...
@@ -523,13 +631,17 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
*/
case
EAGAIN
:
#endif
/* asynchronous connect, wait for connect or timeout */
if
(
data
->
state
.
used_interface
==
Curl_if_multi
)
/* don't hang when doing multi */
timeout_ms
=
0
;
rc
=
waitconnect
(
sockfd
,
timeout_ms
);
break
;
default:
/* unknown error, fallthrough and try another address! */
failf
(
data
,
"Failed to connect to IP number %d"
,
aliasindex
+
1
);
failf
(
data
,
"Failed to connect to %s IP number %d: %d"
,
hostname
,
aliasindex
+
1
,
error
);
break
;
}
}
...
...
@@ -538,6 +650,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
int
err
=
socketerror
(
sockfd
);
if
((
0
==
err
)
||
(
EISCONN
==
err
))
{
/* we are connected, awesome! */
*
connected
=
TRUE
;
/* this is a true connect */
break
;
}
/* nope, not connected for real */
...
...
@@ -545,6 +658,12 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
}
if
(
0
!=
rc
)
{
if
(
data
->
state
.
used_interface
==
Curl_if_multi
)
{
/* When running the multi interface, we bail out here */
rc
=
0
;
break
;
}
/* get a new timeout for next attempt */
after
=
Curl_tvnow
();
timeout_ms
-=
Curl_tvdiff
(
after
,
before
);
...
...
@@ -561,7 +680,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/* no good connect was made */
sclose
(
sockfd
);
*
sockconn
=
-
1
;
failf
(
data
,
"Co
uldn't connect to host
"
);
failf
(
data
,
"Co
nnect failed
"
);
return
CURLE_COULDNT_CONNECT
;
}
...
...
@@ -569,7 +688,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
if
(
addr
)
/* this is the address we've connected to */
*
addr
=
(
struct
in_addr
*
)
remotehost
->
h_addr_list
[
aliasindex
];
*
addr
=
(
struct
in_addr
*
)
remotehost
->
addr
->
h_addr_list
[
aliasindex
];
#endif
/* allow NULL-pointers to get passed in */
...
...
Source/CTest/Curl/connect.h
View file @
3ad91bf9
#ifndef __CONNECT_H
#define __CONNECT_H
/***************************************************************************
**
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$