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
b4dde78a
Unverified
Commit
b4dde78a
authored
Feb 27, 2018
by
Edward Thomson
Committed by
GitHub
Feb 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4550 from libgit2/ethomson/winhttp
winhttp: enable TLS 1.2
parents
7d906370
5ecb6220
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
deps/winhttp/winhttp.h
+2
-0
src/transports/winhttp.c
+22
-0
No files found.
deps/winhttp/winhttp.h
View file @
b4dde78a
...
@@ -440,6 +440,8 @@ typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
...
@@ -440,6 +440,8 @@ typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
#define WINHTTP_AUTH_SCHEME_BASIC 0x00000001
#define WINHTTP_AUTH_SCHEME_BASIC 0x00000001
...
...
src/transports/winhttp.c
View file @
b4dde78a
...
@@ -40,6 +40,14 @@
...
@@ -40,6 +40,14 @@
#define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
#define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
#endif
#endif
#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS_1_1
# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
#endif
#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS_1_2
# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
#endif
static
const
char
*
prefix_https
=
"https://"
;
static
const
char
*
prefix_https
=
"https://"
;
static
const
char
*
upload_pack_service
=
"upload-pack"
;
static
const
char
*
upload_pack_service
=
"upload-pack"
;
static
const
char
*
upload_pack_ls_service_url
=
"/info/refs?service=git-upload-pack"
;
static
const
char
*
upload_pack_ls_service_url
=
"/info/refs?service=git-upload-pack"
;
...
@@ -744,6 +752,10 @@ static int winhttp_connect(
...
@@ -744,6 +752,10 @@ static int winhttp_connect(
int
error
=
-
1
;
int
error
=
-
1
;
int
default_timeout
=
TIMEOUT_INFINITE
;
int
default_timeout
=
TIMEOUT_INFINITE
;
int
default_connect_timeout
=
DEFAULT_CONNECT_TIMEOUT
;
int
default_connect_timeout
=
DEFAULT_CONNECT_TIMEOUT
;
DWORD
protocols
=
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2
;
t
->
session
=
NULL
;
t
->
session
=
NULL
;
t
->
connection
=
NULL
;
t
->
connection
=
NULL
;
...
@@ -786,6 +798,16 @@ static int winhttp_connect(
...
@@ -786,6 +798,16 @@ static int winhttp_connect(
goto
on_error
;
goto
on_error
;
}
}
/*
* Do a best-effort attempt to enable TLS 1.2 but allow this to
* fail; if TLS 1.2 support is not available for some reason,
* ignore the failure (it will keep the default protocols).
*/
WinHttpSetOption
(
t
->
session
,
WINHTTP_OPTION_SECURE_PROTOCOLS
,
&
protocols
,
sizeof
(
protocols
));
if
(
!
WinHttpSetTimeouts
(
t
->
session
,
default_timeout
,
default_connect_timeout
,
default_timeout
,
default_timeout
))
{
if
(
!
WinHttpSetTimeouts
(
t
->
session
,
default_timeout
,
default_connect_timeout
,
default_timeout
,
default_timeout
))
{
giterr_set
(
GITERR_OS
,
"failed to set timeouts for WinHTTP"
);
giterr_set
(
GITERR_OS
,
"failed to set timeouts for WinHTTP"
);
goto
on_error
;
goto
on_error
;
...
...
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