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
59d6128e
Commit
59d6128e
authored
Sep 04, 2015
by
Matt Burke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the world to set HTTP headers for remotes
parent
ac9b5127
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
3 deletions
+16
-3
include/git2/remote.h
+3
-0
src/remote.c
+11
-1
src/remote.h
+1
-1
src/transports/http.c
+1
-1
No files found.
include/git2/remote.h
View file @
59d6128e
...
...
@@ -230,6 +230,9 @@ GIT_EXTERN(size_t) git_remote_refspec_count(const git_remote *remote);
*/
GIT_EXTERN
(
const
git_refspec
*
)
git_remote_get_refspec
(
const
git_remote
*
remote
,
size_t
n
);
GIT_EXTERN
(
int
)
git_remote_extra_http_headers
(
const
git_remote
*
remote
,
git_strarray
*
extra_http_headers
);
GIT_EXTERN
(
int
)
git_remote_set_extra_http_headers
(
git_remote
*
remote
,
const
git_strarray
extra_http_headers
);
/**
* Open a connection to a remote
*
...
...
src/remote.c
View file @
59d6128e
...
...
@@ -1643,7 +1643,7 @@ void git_remote_free(git_remote *remote)
free_refspecs
(
&
remote
->
passive_refspecs
);
git_vector_free
(
&
remote
->
passive_refspecs
);
git_
_free
(
remote
->
extra_http_headers
);
git_
strarray_free
(
&
remote
->
extra_http_headers
);
git_push_free
(
remote
->
push
);
git__free
(
remote
->
url
);
...
...
@@ -2154,6 +2154,16 @@ size_t git_remote_refspec_count(const git_remote *remote)
return
remote
->
refspecs
.
length
;
}
int
git_remote_extra_http_headers
(
const
git_remote
*
remote
,
git_strarray
*
extra_http_headers
)
{
return
git_strarray_copy
(
extra_http_headers
,
&
remote
->
extra_http_headers
);
}
int
git_remote_set_extra_http_headers
(
git_remote
*
remote
,
const
git_strarray
extra_http_headers
)
{
return
git_strarray_copy
(
&
remote
->
extra_http_headers
,
&
extra_http_headers
);
}
const
git_refspec
*
git_remote_get_refspec
(
const
git_remote
*
remote
,
size_t
n
)
{
return
git_vector_get
(
&
remote
->
refspecs
,
n
);
...
...
src/remote.h
View file @
59d6128e
...
...
@@ -32,7 +32,7 @@ struct git_remote {
git_remote_autotag_option_t
download_tags
;
int
prune_refs
;
int
passed_refspecs
;
git_strarray
*
extra_http_headers
;
git_strarray
extra_http_headers
;
};
const
char
*
git_remote__urlfordirection
(
struct
git_remote
*
remote
,
int
direction
);
...
...
src/transports/http.c
View file @
59d6128e
...
...
@@ -974,7 +974,7 @@ static int http_action(
if
((
!
t
->
connection_data
.
host
||
!
t
->
connection_data
.
port
||
!
t
->
connection_data
.
path
)
&&
(
ret
=
gitno_connection_data_from_url
(
&
t
->
connection_data
,
url
,
NULL
))
<
0
)
return
ret
;
t
->
connection_data
.
extra_headers
=
t
->
owner
->
owner
->
extra_http_headers
;
t
->
connection_data
.
extra_headers
=
&
t
->
owner
->
owner
->
extra_http_headers
;
if
((
ret
=
http_connect
(
t
))
<
0
)
return
ret
;
...
...
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