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
248c2b9b
Commit
248c2b9b
authored
16 years ago
by
Dan Fandrich
Browse files
Options
Downloads
Patches
Plain Diff
Eliminate a unnecessary socket creation in Curl_getaddrinfo for an IPv4
address in an IPv6 capable libcurl.
parent
a8baa050
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/hostthre.c
+27
-26
27 additions, 26 deletions
lib/hostthre.c
with
27 additions
and
26 deletions
lib/hostthre.c
+
27
−
26
View file @
248c2b9b
...
...
@@ -771,40 +771,41 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
struct
addrinfo
hints
,
*
res
;
int
error
;
char
sbuf
[
NI_MAXSERV
];
curl_socket_t
s
;
int
pf
;
struct
SessionHandle
*
data
=
conn
->
data
;
*
waitp
=
FALSE
;
/* default to synch response */
/* see if we have an IPv6 stack */
s
=
socket
(
PF_INET6
,
SOCK_DGRAM
,
0
);
if
(
s
==
CURL_SOCKET_BAD
)
{
/* Some non-IPv6 stacks have been found to make very slow name resolves
* when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if
* the stack seems to be a non-ipv6 one. */
/*
* Check if a limited name resolve has been requested.
*/
switch
(
data
->
set
.
ip_version
)
{
case
CURL_IPRESOLVE_V4
:
pf
=
PF_INET
;
}
else
{
/* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest
* possible checks. And close the socket again.
*/
sclose
(
s
);
break
;
case
CURL_IPRESOLVE_V6
:
pf
=
PF_INET6
;
break
;
default:
pf
=
PF_UNSPEC
;
break
;
}
if
(
pf
!=
PF_INET
)
{
/* see if we have an IPv6 stack */
curl_socket_t
s
=
socket
(
PF_INET6
,
SOCK_DGRAM
,
0
);
if
(
s
==
CURL_SOCKET_BAD
)
{
/* Some non-IPv6 stacks have been found to make very slow name resolves
* when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if
* the stack seems to be a non-ipv6 one. */
/*
* Check if a more limited name resolve has been requested.
*/
switch
(
data
->
set
.
ip_version
)
{
case
CURL_IPRESOLVE_V4
:
pf
=
PF_INET
;
break
;
case
CURL_IPRESOLVE_V6
:
pf
=
PF_INET6
;
break
;
default:
pf
=
PF_UNSPEC
;
break
;
}
else
{
/* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest
* possible checks. And close the socket again.
*/
sclose
(
s
);
}
}
...
...
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