Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
16768191
Commit
16768191
authored
May 17, 2012
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ssl: match host names according to RFC 2818 (HTTP over TLS)
parent
dbb36e1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
src/netops.c
+17
-9
No files found.
src/netops.c
View file @
16768191
...
...
@@ -194,13 +194,11 @@ int gitno_ssl_teardown(git_transport *t)
#ifdef GIT_OPENSSL
/*
* This function is based on the one from the cURL project
*/
/* Match host names according to RFC 2818 rules */
static
int
match_host
(
const
char
*
pattern
,
const
char
*
host
)
{
for
(;;)
{
char
c
=
*
pattern
++
;
char
c
=
tolower
(
*
pattern
++
)
;
if
(
c
==
'\0'
)
return
*
host
?
-
1
:
0
;
...
...
@@ -211,14 +209,24 @@ static int match_host(const char *pattern, const char *host)
if
(
c
==
'\0'
)
return
0
;
while
(
*
host
)
{
if
(
match_host
(
pattern
,
host
++
)
==
0
)
return
0
;
/*
* We've found a pattern, so move towards the next matching
* char. The '.' is handled specially because wildcards aren't
* allowed to cross subdomains.
*/
while
(
*
host
)
{
char
h
=
tolower
(
*
host
);
if
(
c
==
h
)
return
match_host
(
pattern
,
host
++
);
if
(
h
==
'.'
)
return
match_host
(
pattern
,
host
);
host
++
;
}
break
;
return
-
1
;
}
if
(
tolower
(
c
)
!=
tolower
(
*
host
++
))
if
(
c
!=
tolower
(
*
host
++
))
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment