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
8a4eb8ed
Commit
8a4eb8ed
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
move the port number extraction to after the extraction of user name/password,
as suggested by Kai Sommerfeld
parent
eee70dcf
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/url.c
+48
-48
48 additions, 48 deletions
lib/url.c
with
48 additions
and
48 deletions
lib/url.c
+
48
−
48
View file @
8a4eb8ed
...
...
@@ -2885,54 +2885,6 @@ static CURLcode CreateConnection(struct SessionHandle *data,
return
CURLE_UNSUPPORTED_PROTOCOL
;
}
/*************************************************************
* Figure out the remote port number
*
* No matter if we use a proxy or not, we have to figure out the remote
* port number of various reasons.
*
* To be able to detect port number flawlessly, we must not confuse them
* IPv6-specified addresses in the [0::1] style. (RFC2732)
*
* The conn->host.name is currently [user:passwd@]host[:port] where host
* could be a hostname, IPv4 address or IPv6 address.
*************************************************************/
if
((
1
==
sscanf
(
conn
->
host
.
name
,
"[%*39[0-9a-fA-F:.]%c"
,
&
endbracket
))
&&
(
']'
==
endbracket
))
{
/* this is a RFC2732-style specified IP-address */
conn
->
bits
.
ipv6_ip
=
TRUE
;
conn
->
host
.
name
++
;
/* pass the starting bracket */
tmp
=
strchr
(
conn
->
host
.
name
,
']'
);
*
tmp
=
0
;
/* zero terminate */
tmp
++
;
/* pass the ending bracket */
if
(
':'
!=
*
tmp
)
tmp
=
NULL
;
/* no port number available */
}
else
tmp
=
strrchr
(
conn
->
host
.
name
,
':'
);
if
(
tmp
)
{
char
*
rest
;
unsigned
long
port
;
port
=
strtoul
(
tmp
+
1
,
&
rest
,
10
);
/* Port number must be decimal */
if
(
rest
!=
(
tmp
+
1
)
&&
*
rest
==
'\0'
)
{
/* The colon really did have only digits after it,
* so it is either a port number or a mistake */
if
(
port
>
0xffff
)
{
/* Single unix standard says port numbers are
* 16 bits long */
failf
(
data
,
"Port number too large: %lu"
,
port
);
return
CURLE_URL_MALFORMAT
;
}
*
tmp
=
'\0'
;
/* cut off the name there */
conn
->
remote_port
=
(
unsigned
short
)
port
;
}
}
if
(
data
->
change
.
proxy
&&
*
data
->
change
.
proxy
)
{
/* If this is supposed to use a proxy, we need to figure out the proxy
host name name, so that we can re-use an existing connection
...
...
@@ -3079,6 +3031,54 @@ static CURLcode CreateConnection(struct SessionHandle *data,
}
}
/*************************************************************
* Figure out the remote port number
*
* No matter if we use a proxy or not, we have to figure out the remote
* port number of various reasons.
*
* To be able to detect port number flawlessly, we must not confuse them
* IPv6-specified addresses in the [0::1] style. (RFC2732)
*
* The conn->host.name is currently [user:passwd@]host[:port] where host
* could be a hostname, IPv4 address or IPv6 address.
*************************************************************/
if
((
1
==
sscanf
(
conn
->
host
.
name
,
"[%*39[0-9a-fA-F:.]%c"
,
&
endbracket
))
&&
(
']'
==
endbracket
))
{
/* this is a RFC2732-style specified IP-address */
conn
->
bits
.
ipv6_ip
=
TRUE
;
conn
->
host
.
name
++
;
/* pass the starting bracket */
tmp
=
strchr
(
conn
->
host
.
name
,
']'
);
*
tmp
=
0
;
/* zero terminate */
tmp
++
;
/* pass the ending bracket */
if
(
':'
!=
*
tmp
)
tmp
=
NULL
;
/* no port number available */
}
else
tmp
=
strrchr
(
conn
->
host
.
name
,
':'
);
if
(
tmp
)
{
char
*
rest
;
unsigned
long
port
;
port
=
strtoul
(
tmp
+
1
,
&
rest
,
10
);
/* Port number must be decimal */
if
(
rest
!=
(
tmp
+
1
)
&&
*
rest
==
'\0'
)
{
/* The colon really did have only digits after it,
* so it is either a port number or a mistake */
if
(
port
>
0xffff
)
{
/* Single unix standard says port numbers are
* 16 bits long */
failf
(
data
,
"Port number too large: %lu"
,
port
);
return
CURLE_URL_MALFORMAT
;
}
*
tmp
=
'\0'
;
/* cut off the name there */
conn
->
remote_port
=
(
unsigned
short
)
port
;
}
}
/* Programmatically set password:
* - always applies, if available
* - takes precedence over the values we just set above
...
...
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