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
193fe9cb
Commit
193fe9cb
authored
Jul 03, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2459 from libgit2/cmn/http-url-path
netops: error out on url without a path
parents
cb6e68c7
1380e7c6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
src/netops.c
+3
-0
tests/network/urlparse.c
+18
-0
No files found.
src/netops.c
View file @
193fe9cb
...
...
@@ -717,6 +717,9 @@ int gitno_extract_url_parts(
if
(
u
.
field_set
&
(
1
<<
UF_PATH
))
{
*
path
=
git__substrdup
(
_path
,
u
.
field_data
[
UF_PATH
].
len
);
GITERR_CHECK_ALLOC
(
*
path
);
}
else
{
giterr_set
(
GITERR_NET
,
"invalid url, missing path"
);
return
GIT_EINVALIDSPEC
;
}
if
(
u
.
field_set
&
(
1
<<
UF_USERINFO
))
{
...
...
tests/network/urlparse.c
View file @
193fe9cb
...
...
@@ -33,6 +33,24 @@ void test_network_urlparse__trivial(void)
cl_assert_equal_p
(
pass
,
NULL
);
}
void
test_network_urlparse__root
(
void
)
{
cl_git_pass
(
gitno_extract_url_parts
(
&
host
,
&
port
,
&
path
,
&
user
,
&
pass
,
"http://example.com/"
,
"8080"
));
cl_assert_equal_s
(
host
,
"example.com"
);
cl_assert_equal_s
(
port
,
"8080"
);
cl_assert_equal_s
(
path
,
"/"
);
cl_assert_equal_p
(
user
,
NULL
);
cl_assert_equal_p
(
pass
,
NULL
);
}
void
test_network_urlparse__just_hostname
(
void
)
{
cl_git_fail_with
(
GIT_EINVALIDSPEC
,
gitno_extract_url_parts
(
&
host
,
&
port
,
&
path
,
&
user
,
&
pass
,
"http://example.com"
,
"8080"
));
}
void
test_network_urlparse__encoded_password
(
void
)
{
cl_git_pass
(
gitno_extract_url_parts
(
&
host
,
&
port
,
&
path
,
&
user
,
&
pass
,
...
...
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