Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
6918427f
Commit
6918427f
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
conn->hp is now conn->hostaddr
changed the Curl_connethost() proto again
parent
9d342bbf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/connect.c
+26
-11
26 additions, 11 deletions
lib/connect.c
lib/connect.h
+2
-0
2 additions, 0 deletions
lib/connect.h
lib/url.c
+12
-10
12 additions, 10 deletions
lib/url.c
with
40 additions
and
21 deletions
lib/connect.c
+
26
−
11
View file @
6918427f
...
...
@@ -160,6 +160,8 @@ int waitconnect(int sockfd, /* socket */
CURLcode
Curl_connecthost
(
struct
connectdata
*
conn
,
long
timeout_ms
,
Curl_addrinfo
*
remotehost
,
int
port
,
int
sockfd
,
/* input socket, or -1 if none */
int
*
socket
)
{
...
...
@@ -177,7 +179,7 @@ CURLcode Curl_connecthost(struct connectdata *conn,
/* don't use any previous one, it might be of wrong type */
sclose
(
sockfd
);
sockfd
=
-
1
;
/* none! */
for
(
ai
=
conn
->
hp
;
ai
;
ai
=
ai
->
ai_next
)
{
for
(
ai
=
remotehost
;
ai
;
ai
=
ai
->
ai_next
)
{
sockfd
=
socket
(
ai
->
ai_family
,
ai
->
ai_socktype
,
ai
->
ai_protocol
);
if
(
sockfd
<
0
)
continue
;
...
...
@@ -219,6 +221,14 @@ CURLcode Curl_connecthost(struct connectdata *conn,
* Connecting with IPv4-only support
*/
int
aliasindex
;
struct
sockaddr_in
serv_addr
;
if
(
-
1
==
sockfd
)
/* create an ordinary socket if none was provided */
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
-
1
==
sockfd
)
return
CURLE_COULDNT_CONNECT
;
/* big time error */
/* non-block socket */
nonblock
(
sockfd
,
TRUE
);
...
...
@@ -226,20 +236,20 @@ CURLcode Curl_connecthost(struct connectdata *conn,
/* 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
*
)
conn
->
hp
->
h_addr_list
[
aliasindex
];
rc
&&
(
struct
in_addr
*
)
remotehost
->
h_addr_list
[
aliasindex
];
aliasindex
++
)
{
/* copy this particular name info to the conn struct as it might
be used later in the krb4 "system" */
memset
((
char
*
)
&
conn
->
serv_addr
,
'\0'
,
sizeof
(
conn
->
serv_addr
));
memcpy
((
char
*
)
&
(
conn
->
serv_addr
.
sin_addr
),
(
struct
in_addr
*
)
conn
->
hp
->
h_addr_list
[
aliasindex
],
memset
((
char
*
)
&
serv_addr
,
'\0'
,
sizeof
(
serv_addr
));
memcpy
((
char
*
)
&
(
serv_addr
.
sin_addr
),
(
struct
in_addr
*
)
remotehost
->
h_addr_list
[
aliasindex
],
sizeof
(
struct
in_addr
));
conn
->
serv_addr
.
sin_family
=
conn
->
hp
->
h_addrtype
;
conn
->
serv_addr
.
sin_port
=
htons
(
conn
->
port
);
serv_addr
.
sin_family
=
remotehost
->
h_addrtype
;
serv_addr
.
sin_port
=
htons
(
port
);
rc
=
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
(
conn
->
serv_addr
)
,
sizeof
(
conn
->
serv_addr
));
rc
=
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
));
if
(
-
1
==
rc
)
{
int
error
;
...
...
@@ -275,8 +285,13 @@ CURLcode Curl_connecthost(struct connectdata *conn,
before
=
after
;
continue
;
/* try next address */
}
else
break
;
else
{
/* copy this particular name info to the conn struct as it might
be used later in the krb4 "system" */
memcpy
((
char
*
)
&
conn
->
serv_addr
,
&
serv_addr
,
sizeof
(
conn
->
serv_addr
));
}
break
;
}
if
(
-
1
==
rc
)
{
/* no good connect was made */
...
...
This diff is collapsed.
Click to expand it.
lib/connect.h
+
2
−
0
View file @
6918427f
...
...
@@ -25,6 +25,8 @@
CURLcode
Curl_connecthost
(
struct
connectdata
*
conn
,
long
timeout
,
/* milliseconds */
Curl_addrinfo
*
host
,
/* connect to this */
long
port
,
/* connect to this port number */
int
sockfd
,
/* input socket, or -1 if none */
int
*
socket
);
/* not set if error is returned */
#endif
This diff is collapsed.
Click to expand it.
lib/url.c
+
12
−
10
View file @
6918427f
...
...
@@ -880,8 +880,8 @@ CURLcode Curl_disconnect(struct connectdata *conn)
free
(
conn
->
proto
.
generic
);
#ifdef ENABLE_IPV6
if
(
conn
->
h
p
)
/* host name info */
freeaddrinfo
(
conn
->
h
p
);
if
(
conn
->
h
ostaddr
)
/* host name info */
freeaddrinfo
(
conn
->
h
ostaddr
);
#else
if
(
conn
->
hostent_buf
)
/* host name info */
free
(
conn
->
hostent_buf
);
...
...
@@ -1276,6 +1276,8 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
*************************************************************/
return
Curl_connecthost
(
conn
,
max_time
,
conn
->
hostaddr
,
conn
->
port
,
conn
->
firstsocket
,
/* might be bind()ed */
&
conn
->
firstsocket
);
}
...
...
@@ -2086,26 +2088,26 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn
->
port
=
conn
->
remote_port
;
/* it is the same port */
/* Resolve target host right on */
if
(
!
conn
->
h
p
)
{
if
(
!
conn
->
h
ostaddr
)
{
/* it might already be set if reusing a connection */
conn
->
h
p
=
Curl_getaddrinfo
(
data
,
conn
->
name
,
conn
->
port
,
conn
->
h
ostaddr
=
Curl_getaddrinfo
(
data
,
conn
->
name
,
conn
->
port
,
&
conn
->
hostent_buf
);
}
if
(
!
conn
->
h
p
)
{
if
(
!
conn
->
h
ostaddr
)
{
failf
(
data
,
"Couldn't resolve host '%s'"
,
conn
->
name
);
return
CURLE_COULDNT_RESOLVE_HOST
;
}
}
else
if
(
!
conn
->
h
p
)
{
else
if
(
!
conn
->
h
ostaddr
)
{
/* This is a proxy that hasn't been resolved yet. It may be resolved
if we're reusing an existing connection. */
/* resolve proxy */
/* it might already be set if reusing a connection */
conn
->
h
p
=
Curl_getaddrinfo
(
data
,
conn
->
proxyhost
,
conn
->
port
,
conn
->
h
ostaddr
=
Curl_getaddrinfo
(
data
,
conn
->
proxyhost
,
conn
->
port
,
&
conn
->
hostent_buf
);
if
(
!
conn
->
h
p
)
{
if
(
!
conn
->
h
ostaddr
)
{
failf
(
data
,
"Couldn't resolve proxy '%s'"
,
conn
->
proxyhost
);
return
CURLE_COULDNT_RESOLVE_PROXY
;
}
...
...
@@ -2195,8 +2197,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
#else
{
struct
in_addr
in
;
(
void
)
memcpy
(
&
in
.
s_addr
,
*
conn
->
h
p
->
h_addr_list
,
sizeof
(
in
.
s_addr
));
infof
(
data
,
"Connected to %s (%s)
\n
"
,
conn
->
h
p
->
h_name
,
inet_ntoa
(
in
));
(
void
)
memcpy
(
&
in
.
s_addr
,
*
conn
->
h
ostaddr
->
h_addr_list
,
sizeof
(
in
.
s_addr
));
infof
(
data
,
"Connected to %s (%s)
\n
"
,
conn
->
h
ostaddr
->
h_name
,
inet_ntoa
(
in
));
}
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment