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
016179d6
Commit
016179d6
authored
Jan 31, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WinHttp: use cred in url if provided
parent
54ffc1f7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
src/transports/winhttp.c
+16
-3
No files found.
src/transports/winhttp.c
View file @
016179d6
...
@@ -73,7 +73,10 @@ typedef struct {
...
@@ -73,7 +73,10 @@ typedef struct {
const
char
*
path
;
const
char
*
path
;
char
*
host
;
char
*
host
;
char
*
port
;
char
*
port
;
char
*
user_from_url
;
char
*
pass_from_url
;
git_cred
*
cred
;
git_cred
*
cred
;
git_cred
*
url_cred
;
int
auth_mechanism
;
int
auth_mechanism
;
HINTERNET
session
;
HINTERNET
session
;
HINTERNET
connection
;
HINTERNET
connection
;
...
@@ -250,6 +253,16 @@ static int winhttp_stream_connect(winhttp_stream *s)
...
@@ -250,6 +253,16 @@ static int winhttp_stream_connect(winhttp_stream *s)
apply_basic_credential
(
s
->
request
,
t
->
cred
)
<
0
)
apply_basic_credential
(
s
->
request
,
t
->
cred
)
<
0
)
goto
on_error
;
goto
on_error
;
/* If no other credentials have been applied and the URL has username and
* password, use those */
if
(
!
t
->
cred
&&
t
->
user_from_url
&&
t
->
pass_from_url
)
{
if
(
!
t
->
url_cred
&&
git_cred_userpass_plaintext_new
(
&
t
->
url_cred
,
t
->
user_from_url
,
t
->
pass_from_url
)
<
0
)
goto
on_error
;
if
(
apply_basic_credential
(
s
->
request
,
t
->
url_cred
)
<
0
)
goto
on_error
;
}
/* We've done everything up to calling WinHttpSendRequest. */
/* We've done everything up to calling WinHttpSendRequest. */
error
=
0
;
error
=
0
;
...
@@ -447,7 +460,7 @@ replay:
...
@@ -447,7 +460,7 @@ replay:
if
(
allowed_types
&&
if
(
allowed_types
&&
(
!
t
->
cred
||
0
==
(
t
->
cred
->
credtype
&
allowed_types
)))
{
(
!
t
->
cred
||
0
==
(
t
->
cred
->
credtype
&
allowed_types
)))
{
if
(
t
->
owner
->
cred_acquire_cb
(
&
t
->
cred
,
t
->
owner
->
url
,
allowed_types
,
t
->
owner
->
cred_acquire_payload
)
<
0
)
if
(
t
->
owner
->
cred_acquire_cb
(
&
t
->
cred
,
t
->
owner
->
url
,
t
->
user_from_url
,
allowed_types
,
t
->
owner
->
cred_acquire_payload
)
<
0
)
return
-
1
;
return
-
1
;
assert
(
t
->
cred
);
assert
(
t
->
cred
);
...
@@ -788,8 +801,8 @@ static int winhttp_connect(
...
@@ -788,8 +801,8 @@ static int winhttp_connect(
t
->
use_ssl
=
1
;
t
->
use_ssl
=
1
;
}
}
if
((
ret
=
gitno_extract_url_parts
(
&
t
->
host
,
&
t
->
port
,
&
t
->
parent
.
user_from_url
,
if
((
ret
=
gitno_extract_url_parts
(
&
t
->
host
,
&
t
->
port
,
&
t
->
user_from_url
,
&
t
->
pa
rent
.
pa
ss_from_url
,
url
,
default_port
))
<
0
)
&
t
->
pass_from_url
,
url
,
default_port
))
<
0
)
return
ret
;
return
ret
;
t
->
path
=
strchr
(
url
,
'/'
);
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