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
2234b2b0
Commit
2234b2b0
authored
Jan 30, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stash username from url (but don't use it yet)
parent
5f10853e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
9 deletions
+17
-9
src/netops.c
+7
-2
src/netops.h
+1
-1
src/transports/git.c
+6
-4
src/transports/http.c
+2
-1
src/transports/winhttp.c
+1
-1
No files found.
src/netops.c
View file @
2234b2b0
...
...
@@ -578,7 +578,7 @@ int gitno_select_in(gitno_buffer *buf, long int sec, long int usec)
return
select
((
int
)
buf
->
socket
->
socket
+
1
,
&
fds
,
NULL
,
NULL
,
&
tv
);
}
int
gitno_extract_host_and_port
(
char
**
host
,
char
**
port
,
const
char
*
url
,
const
char
*
default_port
)
int
gitno_extract_host_and_port
(
char
**
host
,
char
**
port
,
c
har
**
username
,
c
onst
char
*
url
,
const
char
*
default_port
)
{
char
*
colon
,
*
slash
,
*
at
,
*
delim
;
const
char
*
start
;
...
...
@@ -600,7 +600,12 @@ int gitno_extract_host_and_port(char **host, char **port, const char *url, const
GITERR_CHECK_ALLOC
(
*
port
);
delim
=
colon
==
NULL
?
slash
:
colon
;
start
=
at
==
NULL
&&
at
<
slash
?
url
:
at
+
1
;
start
=
url
;
if
(
at
&&
at
<
slash
)
{
start
=
at
+
1
;
*
username
=
git__strndup
(
url
,
at
-
url
);
}
*
host
=
git__strndup
(
start
,
delim
-
start
);
GITERR_CHECK_ALLOC
(
*
host
);
...
...
src/netops.h
View file @
2234b2b0
...
...
@@ -66,6 +66,6 @@ int gitno_send(gitno_socket *socket, const char *msg, size_t len, int flags);
int
gitno_close
(
gitno_socket
*
s
);
int
gitno_select_in
(
gitno_buffer
*
buf
,
long
int
sec
,
long
int
usec
);
int
gitno_extract_host_and_port
(
char
**
host
,
char
**
port
,
const
char
*
url
,
const
char
*
default_port
);
int
gitno_extract_host_and_port
(
char
**
host
,
char
**
port
,
c
har
**
username
,
c
onst
char
*
url
,
const
char
*
default_port
);
#endif
src/transports/git.c
View file @
2234b2b0
...
...
@@ -179,7 +179,7 @@ static int _git_uploadpack_ls(
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
char
*
host
,
*
port
;
char
*
host
,
*
port
,
*
user
;
git_stream
*
s
;
*
stream
=
NULL
;
...
...
@@ -192,7 +192,7 @@ static int _git_uploadpack_ls(
s
=
(
git_stream
*
)
*
stream
;
if
(
gitno_extract_host_and_port
(
&
host
,
&
port
,
url
,
GIT_DEFAULT_PORT
)
<
0
)
if
(
gitno_extract_host_and_port
(
&
host
,
&
port
,
&
user
,
url
,
GIT_DEFAULT_PORT
)
<
0
)
goto
on_error
;
if
(
gitno_connect
(
&
s
->
socket
,
host
,
port
,
0
)
<
0
)
...
...
@@ -201,6 +201,7 @@ static int _git_uploadpack_ls(
t
->
current_stream
=
s
;
git__free
(
host
);
git__free
(
port
);
git__free
(
user
);
return
0
;
on_error:
...
...
@@ -233,7 +234,7 @@ static int _git_receivepack_ls(
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
char
*
host
,
*
port
;
char
*
host
,
*
port
,
*
user
;
git_stream
*
s
;
*
stream
=
NULL
;
...
...
@@ -246,7 +247,7 @@ static int _git_receivepack_ls(
s
=
(
git_stream
*
)
*
stream
;
if
(
gitno_extract_host_and_port
(
&
host
,
&
port
,
url
,
GIT_DEFAULT_PORT
)
<
0
)
if
(
gitno_extract_host_and_port
(
&
host
,
&
port
,
&
user
,
url
,
GIT_DEFAULT_PORT
)
<
0
)
goto
on_error
;
if
(
gitno_connect
(
&
s
->
socket
,
host
,
port
,
0
)
<
0
)
...
...
@@ -255,6 +256,7 @@ static int _git_receivepack_ls(
t
->
current_stream
=
s
;
git__free
(
host
);
git__free
(
port
);
git__free
(
user
);
return
0
;
on_error:
...
...
src/transports/http.c
View file @
2234b2b0
...
...
@@ -60,6 +60,7 @@ typedef struct {
const
char
*
path
;
char
*
host
;
char
*
port
;
char
*
user_from_url
;
git_cred
*
cred
;
http_authmechanism_t
auth_mechanism
;
unsigned
connected
:
1
,
...
...
@@ -742,7 +743,7 @@ static int http_action(
if
(
!
default_port
)
return
-
1
;
if
((
ret
=
gitno_extract_host_and_port
(
&
t
->
host
,
&
t
->
port
,
if
((
ret
=
gitno_extract_host_and_port
(
&
t
->
host
,
&
t
->
port
,
&
t
->
user_from_url
,
url
,
default_port
))
<
0
)
return
ret
;
...
...
src/transports/winhttp.c
View file @
2234b2b0
...
...
@@ -788,7 +788,7 @@ static int winhttp_connect(
t
->
use_ssl
=
1
;
}
if
((
ret
=
gitno_extract_host_and_port
(
&
t
->
host
,
&
t
->
port
,
url
,
default_port
))
<
0
)
if
((
ret
=
gitno_extract_host_and_port
(
&
t
->
host
,
&
t
->
port
,
&
t
->
parent
.
user_from_url
,
url
,
default_port
))
<
0
)
return
ret
;
t
->
path
=
strchr
(
url
,
'/'
);
...
...
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