rugged 0.28.4 → 0.28.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +16 -36
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -2
- data/vendor/libgit2/include/git2/apply.h +2 -22
- data/vendor/libgit2/include/git2/attr.h +12 -19
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +12 -44
- data/vendor/libgit2/include/git2/buffer.h +14 -20
- data/vendor/libgit2/include/git2/checkout.h +14 -46
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +1 -23
- data/vendor/libgit2/include/git2/common.h +5 -7
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/deprecated.h +3 -243
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +14 -16
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/indexer.h +4 -48
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +10 -6
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/object.h +14 -2
- data/vendor/libgit2/include/git2/odb.h +2 -3
- data/vendor/libgit2/include/git2/odb_backend.h +4 -5
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +1 -12
- data/vendor/libgit2/include/git2/proxy.h +3 -5
- data/vendor/libgit2/include/git2/rebase.h +2 -46
- data/vendor/libgit2/include/git2/refs.h +0 -19
- data/vendor/libgit2/include/git2/remote.h +12 -35
- data/vendor/libgit2/include/git2/repository.h +2 -24
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +16 -25
- data/vendor/libgit2/include/git2/submodule.h +3 -20
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +2 -11
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +340 -11
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +89 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +222 -88
- data/vendor/libgit2/src/alloc.c +14 -2
- data/vendor/libgit2/src/apply.c +30 -60
- data/vendor/libgit2/src/attr.c +64 -70
- data/vendor/libgit2/src/attr_file.c +96 -189
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +46 -44
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +5 -17
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +7 -21
- data/vendor/libgit2/src/blob.c +17 -81
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +5 -29
- data/vendor/libgit2/src/buffer.c +7 -14
- data/vendor/libgit2/src/cache.c +33 -26
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +0 -5
- data/vendor/libgit2/src/checkout.c +16 -26
- data/vendor/libgit2/src/cherrypick.c +3 -9
- data/vendor/libgit2/src/clone.c +7 -29
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +21 -69
- data/vendor/libgit2/src/commit.h +0 -6
- data/vendor/libgit2/src/commit_list.c +76 -28
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +75 -3
- data/vendor/libgit2/src/config.c +40 -31
- data/vendor/libgit2/src/config.h +6 -7
- data/vendor/libgit2/src/config_backend.h +0 -12
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +99 -69
- data/vendor/libgit2/src/config_entries.h +0 -1
- data/vendor/libgit2/src/config_file.c +380 -337
- data/vendor/libgit2/src/config_mem.c +16 -12
- data/vendor/libgit2/src/config_parse.c +29 -49
- data/vendor/libgit2/src/config_parse.h +12 -13
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +20 -21
- data/vendor/libgit2/src/diff.c +58 -43
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +38 -37
- data/vendor/libgit2/src/diff_file.c +7 -9
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +85 -135
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +13 -25
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +22 -12
- data/vendor/libgit2/src/features.h.in +2 -9
- data/vendor/libgit2/src/fetch.c +2 -7
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +10 -6
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
- data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
- data/vendor/libgit2/src/filter.c +8 -16
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +40 -12
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +21 -19
- data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
- data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
- data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
- data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +65 -91
- data/vendor/libgit2/src/idxmap.h +15 -151
- data/vendor/libgit2/src/ignore.c +38 -32
- data/vendor/libgit2/src/index.c +43 -66
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +70 -69
- data/vendor/libgit2/src/integer.h +4 -39
- data/vendor/libgit2/src/iterator.c +22 -27
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +44 -58
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +23 -18
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +165 -55
- data/vendor/libgit2/src/netops.h +25 -3
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +0 -2
- data/vendor/libgit2/src/odb.c +23 -41
- data/vendor/libgit2/src/odb.h +2 -3
- data/vendor/libgit2/src/odb_loose.c +10 -17
- data/vendor/libgit2/src/odb_mempack.c +23 -10
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +55 -43
- data/vendor/libgit2/src/offmap.h +24 -102
- data/vendor/libgit2/src/oid.c +1 -6
- data/vendor/libgit2/src/oidmap.c +57 -39
- data/vendor/libgit2/src/oidmap.h +19 -99
- data/vendor/libgit2/src/pack-objects.c +32 -25
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +47 -45
- data/vendor/libgit2/src/pack.h +14 -12
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +31 -124
- data/vendor/libgit2/src/path.c +6 -43
- data/vendor/libgit2/src/path.h +0 -2
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +2 -7
- data/vendor/libgit2/src/push.c +5 -10
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +7 -66
- data/vendor/libgit2/src/refdb.c +0 -12
- data/vendor/libgit2/src/refdb_fs.c +165 -214
- data/vendor/libgit2/src/reflog.c +13 -11
- data/vendor/libgit2/src/refs.c +18 -24
- data/vendor/libgit2/src/refspec.c +16 -9
- data/vendor/libgit2/src/remote.c +52 -50
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +100 -115
- data/vendor/libgit2/src/repository.h +40 -49
- data/vendor/libgit2/src/revert.c +3 -8
- data/vendor/libgit2/src/revparse.c +19 -18
- data/vendor/libgit2/src/revwalk.c +30 -63
- data/vendor/libgit2/src/revwalk.h +0 -20
- data/vendor/libgit2/src/settings.c +0 -5
- data/vendor/libgit2/src/sortedcache.c +26 -12
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +65 -45
- data/vendor/libgit2/src/status.c +9 -15
- data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
- data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
- data/vendor/libgit2/src/streams/openssl.c +0 -20
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +84 -37
- data/vendor/libgit2/src/strmap.h +33 -105
- data/vendor/libgit2/src/submodule.c +70 -102
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +1 -11
- data/vendor/libgit2/src/tag.c +2 -10
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +32 -46
- data/vendor/libgit2/src/transaction.c +9 -10
- data/vendor/libgit2/src/transports/auth.c +9 -10
- data/vendor/libgit2/src/transports/auth.h +4 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +16 -11
- data/vendor/libgit2/src/transports/http.c +276 -419
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
- data/vendor/libgit2/src/transports/ssh.c +36 -46
- data/vendor/libgit2/src/transports/winhttp.c +207 -231
- data/vendor/libgit2/src/tree-cache.c +7 -14
- data/vendor/libgit2/src/tree.c +24 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +53 -51
- data/vendor/libgit2/src/util.h +21 -16
- data/vendor/libgit2/src/win32/map.c +5 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -12
- data/vendor/libgit2/src/win32/path_w32.h +29 -0
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +5 -40
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
- data/vendor/libgit2/src/win32/w32_stack.c +9 -4
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +0 -31
- data/vendor/libgit2/src/win32/w32_util.h +32 -6
- data/vendor/libgit2/src/worktree.c +22 -36
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- metadata +34 -98
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
#include "repository.h"
|
|
20
20
|
#include "global.h"
|
|
21
21
|
#include "http.h"
|
|
22
|
-
#include "git2/sys/cred.h"
|
|
23
22
|
|
|
24
23
|
#include <wincrypt.h>
|
|
25
24
|
#include <winhttp.h>
|
|
@@ -49,14 +48,6 @@
|
|
|
49
48
|
# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
|
|
50
49
|
#endif
|
|
51
50
|
|
|
52
|
-
#ifndef HTTP_STATUS_PERMANENT_REDIRECT
|
|
53
|
-
# define HTTP_STATUS_PERMANENT_REDIRECT 308
|
|
54
|
-
#endif
|
|
55
|
-
|
|
56
|
-
#ifndef DWORD_MAX
|
|
57
|
-
# define DWORD_MAX 0xffffffff
|
|
58
|
-
#endif
|
|
59
|
-
|
|
60
51
|
static const char *prefix_https = "https://";
|
|
61
52
|
static const char *upload_pack_service = "upload-pack";
|
|
62
53
|
static const char *upload_pack_ls_service_url = "/info/refs?service=git-upload-pack";
|
|
@@ -109,44 +100,24 @@ typedef struct {
|
|
|
109
100
|
chunked : 1;
|
|
110
101
|
} winhttp_stream;
|
|
111
102
|
|
|
112
|
-
typedef struct {
|
|
113
|
-
git_net_url url;
|
|
114
|
-
git_cred *cred;
|
|
115
|
-
int auth_mechanisms;
|
|
116
|
-
bool url_cred_presented;
|
|
117
|
-
} winhttp_server;
|
|
118
|
-
|
|
119
103
|
typedef struct {
|
|
120
104
|
git_smart_subtransport parent;
|
|
121
105
|
transport_smart *owner;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
gitno_connection_data connection_data;
|
|
107
|
+
gitno_connection_data proxy_connection_data;
|
|
108
|
+
git_cred *cred;
|
|
109
|
+
git_cred *url_cred;
|
|
110
|
+
git_cred *proxy_cred;
|
|
111
|
+
int auth_mechanisms;
|
|
126
112
|
HINTERNET session;
|
|
127
113
|
HINTERNET connection;
|
|
128
114
|
} winhttp_subtransport;
|
|
129
115
|
|
|
130
|
-
static int
|
|
116
|
+
static int _apply_userpass_credential(HINTERNET request, DWORD target, DWORD scheme, git_cred *cred)
|
|
131
117
|
{
|
|
132
118
|
git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred;
|
|
133
|
-
wchar_t *user
|
|
119
|
+
wchar_t *user, *pass;
|
|
134
120
|
int user_len = 0, pass_len = 0, error = 0;
|
|
135
|
-
DWORD native_scheme;
|
|
136
|
-
|
|
137
|
-
if (mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE) {
|
|
138
|
-
native_scheme = WINHTTP_AUTH_SCHEME_NEGOTIATE;
|
|
139
|
-
} else if (mechanisms & GIT_WINHTTP_AUTH_NTLM) {
|
|
140
|
-
native_scheme = WINHTTP_AUTH_SCHEME_NTLM;
|
|
141
|
-
} else if (mechanisms & GIT_WINHTTP_AUTH_DIGEST) {
|
|
142
|
-
native_scheme = WINHTTP_AUTH_SCHEME_DIGEST;
|
|
143
|
-
} else if (mechanisms & GIT_WINHTTP_AUTH_BASIC) {
|
|
144
|
-
native_scheme = WINHTTP_AUTH_SCHEME_BASIC;
|
|
145
|
-
} else {
|
|
146
|
-
git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
|
|
147
|
-
error = -1;
|
|
148
|
-
goto done;
|
|
149
|
-
}
|
|
150
121
|
|
|
151
122
|
if ((error = user_len = git__utf8_to_16_alloc(&user, c->username)) < 0)
|
|
152
123
|
goto done;
|
|
@@ -154,7 +125,7 @@ static int apply_userpass_credentials(HINTERNET request, DWORD target, int mecha
|
|
|
154
125
|
if ((error = pass_len = git__utf8_to_16_alloc(&pass, c->password)) < 0)
|
|
155
126
|
goto done;
|
|
156
127
|
|
|
157
|
-
if (!WinHttpSetCredentials(request, target,
|
|
128
|
+
if (!WinHttpSetCredentials(request, target, scheme, user, pass, NULL)) {
|
|
158
129
|
git_error_set(GIT_ERROR_OS, "failed to set credentials");
|
|
159
130
|
error = -1;
|
|
160
131
|
}
|
|
@@ -172,59 +143,78 @@ done:
|
|
|
172
143
|
return error;
|
|
173
144
|
}
|
|
174
145
|
|
|
175
|
-
static int
|
|
146
|
+
static int apply_userpass_credential_proxy(HINTERNET request, git_cred *cred, int mechanisms)
|
|
176
147
|
{
|
|
177
|
-
|
|
178
|
-
|
|
148
|
+
if (GIT_WINHTTP_AUTH_DIGEST & mechanisms) {
|
|
149
|
+
return _apply_userpass_credential(request, WINHTTP_AUTH_TARGET_PROXY,
|
|
150
|
+
WINHTTP_AUTH_SCHEME_DIGEST, cred);
|
|
151
|
+
}
|
|
179
152
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
153
|
+
return _apply_userpass_credential(request, WINHTTP_AUTH_TARGET_PROXY,
|
|
154
|
+
WINHTTP_AUTH_SCHEME_BASIC, cred);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static int apply_userpass_credential(HINTERNET request, int mechanisms, git_cred *cred)
|
|
158
|
+
{
|
|
159
|
+
DWORD native_scheme;
|
|
160
|
+
|
|
161
|
+
if ((mechanisms & GIT_WINHTTP_AUTH_NTLM) ||
|
|
162
|
+
(mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE)) {
|
|
183
163
|
native_scheme = WINHTTP_AUTH_SCHEME_NTLM;
|
|
164
|
+
} else if (mechanisms & GIT_WINHTTP_AUTH_BASIC) {
|
|
165
|
+
native_scheme = WINHTTP_AUTH_SCHEME_BASIC;
|
|
184
166
|
} else {
|
|
185
167
|
git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
|
|
186
168
|
return -1;
|
|
187
169
|
}
|
|
188
170
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
171
|
+
return _apply_userpass_credential(request, WINHTTP_AUTH_TARGET_SERVER,
|
|
172
|
+
native_scheme, cred);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static int apply_default_credentials(HINTERNET request, int mechanisms)
|
|
176
|
+
{
|
|
177
|
+
/* Either the caller explicitly requested that default credentials be passed,
|
|
178
|
+
* or our fallback credential callback was invoked and checked that the target
|
|
179
|
+
* URI was in the appropriate Internet Explorer security zone. By setting this
|
|
180
|
+
* flag, we guarantee that the credentials are delivered by WinHTTP. The default
|
|
181
|
+
* is "medium" which applies to the intranet and sounds like it would correspond
|
|
182
|
+
* to Internet Explorer security zones, but in fact does not. */
|
|
183
|
+
DWORD data = WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW;
|
|
184
|
+
DWORD native_scheme = 0;
|
|
185
|
+
|
|
186
|
+
if ((mechanisms & GIT_WINHTTP_AUTH_NTLM) != 0)
|
|
187
|
+
native_scheme = WINHTTP_AUTH_SCHEME_NTLM;
|
|
188
|
+
|
|
189
|
+
if ((mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE) != 0)
|
|
190
|
+
native_scheme = WINHTTP_AUTH_SCHEME_NEGOTIATE;
|
|
197
191
|
|
|
198
|
-
if (!
|
|
199
|
-
git_error_set(
|
|
192
|
+
if (!native_scheme) {
|
|
193
|
+
git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
|
|
200
194
|
return -1;
|
|
201
195
|
}
|
|
202
196
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
static int acquire_url_cred(
|
|
207
|
-
git_cred **cred,
|
|
208
|
-
unsigned int allowed_types,
|
|
209
|
-
const char *username,
|
|
210
|
-
const char *password)
|
|
211
|
-
{
|
|
212
|
-
if (allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)
|
|
213
|
-
return git_cred_userpass_plaintext_new(cred, username, password);
|
|
197
|
+
if (!WinHttpSetOption(request, WINHTTP_OPTION_AUTOLOGON_POLICY, &data, sizeof(DWORD)))
|
|
198
|
+
return -1;
|
|
214
199
|
|
|
215
|
-
if ((
|
|
216
|
-
return
|
|
200
|
+
if (!WinHttpSetCredentials(request, WINHTTP_AUTH_TARGET_SERVER, native_scheme, NULL, NULL, NULL))
|
|
201
|
+
return -1;
|
|
217
202
|
|
|
218
|
-
return
|
|
203
|
+
return 0;
|
|
219
204
|
}
|
|
220
205
|
|
|
221
|
-
static int
|
|
206
|
+
static int fallback_cred_acquire_cb(
|
|
222
207
|
git_cred **cred,
|
|
223
208
|
const char *url,
|
|
224
|
-
|
|
209
|
+
const char *username_from_url,
|
|
210
|
+
unsigned int allowed_types,
|
|
211
|
+
void *payload)
|
|
225
212
|
{
|
|
226
213
|
int error = 1;
|
|
227
214
|
|
|
215
|
+
GIT_UNUSED(username_from_url);
|
|
216
|
+
GIT_UNUSED(payload);
|
|
217
|
+
|
|
228
218
|
/* If the target URI supports integrated Windows authentication
|
|
229
219
|
* as an authentication mechanism */
|
|
230
220
|
if (GIT_CREDTYPE_DEFAULT & allowed_types) {
|
|
@@ -263,9 +253,9 @@ static int acquire_fallback_cred(
|
|
|
263
253
|
pISM->lpVtbl->Release(pISM);
|
|
264
254
|
}
|
|
265
255
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
256
|
+
if (SUCCEEDED(hCoInitResult))
|
|
257
|
+
/* Only unitialize if the call to CoInitializeEx was successful. */
|
|
258
|
+
CoUninitialize();
|
|
269
259
|
}
|
|
270
260
|
|
|
271
261
|
git__free(wide_url);
|
|
@@ -290,7 +280,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
|
290
280
|
return GIT_ECERTIFICATE;
|
|
291
281
|
}
|
|
292
282
|
|
|
293
|
-
if (t->owner->certificate_check_cb == NULL ||
|
|
283
|
+
if (t->owner->certificate_check_cb == NULL || !t->connection_data.use_ssl)
|
|
294
284
|
return 0;
|
|
295
285
|
|
|
296
286
|
if (!WinHttpQueryOption(s->request, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert_ctx, &cert_ctx_size)) {
|
|
@@ -302,7 +292,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
|
302
292
|
cert.parent.cert_type = GIT_CERT_X509;
|
|
303
293
|
cert.data = cert_ctx->pbCertEncoded;
|
|
304
294
|
cert.len = cert_ctx->cbCertEncoded;
|
|
305
|
-
error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->
|
|
295
|
+
error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->connection_data.host, t->owner->message_cb_payload);
|
|
306
296
|
CertFreeCertificateContext(cert_ctx);
|
|
307
297
|
|
|
308
298
|
if (error == GIT_PASSTHROUGH)
|
|
@@ -339,25 +329,8 @@ static void winhttp_stream_close(winhttp_stream *s)
|
|
|
339
329
|
s->sent_request = 0;
|
|
340
330
|
}
|
|
341
331
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
git_net_url *url,
|
|
345
|
-
int target,
|
|
346
|
-
git_cred *creds,
|
|
347
|
-
int mechanisms)
|
|
348
|
-
{
|
|
349
|
-
int error = 0;
|
|
350
|
-
|
|
351
|
-
GIT_UNUSED(url);
|
|
352
|
-
|
|
353
|
-
/* If we have creds, just apply them */
|
|
354
|
-
if (creds && creds->credtype == GIT_CREDTYPE_USERPASS_PLAINTEXT)
|
|
355
|
-
error = apply_userpass_credentials(request, target, mechanisms, creds);
|
|
356
|
-
else if (creds && creds->credtype == GIT_CREDTYPE_DEFAULT)
|
|
357
|
-
error = apply_default_credentials(request, target, mechanisms);
|
|
358
|
-
|
|
359
|
-
return error;
|
|
360
|
-
}
|
|
332
|
+
#define SCHEME_HTTP "http://"
|
|
333
|
+
#define SCHEME_HTTPS "https://"
|
|
361
334
|
|
|
362
335
|
static int winhttp_stream_connect(winhttp_stream *s)
|
|
363
336
|
{
|
|
@@ -371,13 +344,11 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
371
344
|
unsigned long disable_redirects = WINHTTP_DISABLE_REDIRECTS;
|
|
372
345
|
int default_timeout = TIMEOUT_INFINITE;
|
|
373
346
|
int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
|
374
|
-
DWORD autologon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH;
|
|
375
|
-
|
|
376
347
|
size_t i;
|
|
377
348
|
const git_proxy_options *proxy_opts;
|
|
378
349
|
|
|
379
350
|
/* Prepare URL */
|
|
380
|
-
git_buf_printf(&buf, "%s%s", t->
|
|
351
|
+
git_buf_printf(&buf, "%s%s", t->connection_data.path, s->service_url);
|
|
381
352
|
|
|
382
353
|
if (git_buf_oom(&buf))
|
|
383
354
|
return -1;
|
|
@@ -396,17 +367,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
396
367
|
NULL,
|
|
397
368
|
WINHTTP_NO_REFERER,
|
|
398
369
|
types,
|
|
399
|
-
|
|
370
|
+
t->connection_data.use_ssl ? WINHTTP_FLAG_SECURE : 0);
|
|
400
371
|
|
|
401
372
|
if (!s->request) {
|
|
402
373
|
git_error_set(GIT_ERROR_OS, "failed to open request");
|
|
403
374
|
goto on_error;
|
|
404
375
|
}
|
|
405
376
|
|
|
406
|
-
/* Never attempt default credentials; we'll provide them explicitly. */
|
|
407
|
-
if (!WinHttpSetOption(s->request, WINHTTP_OPTION_AUTOLOGON_POLICY, &autologon_policy, sizeof(DWORD)))
|
|
408
|
-
return -1;
|
|
409
|
-
|
|
410
377
|
if (!WinHttpSetTimeouts(s->request, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
|
|
411
378
|
git_error_set(GIT_ERROR_OS, "failed to set timeouts for WinHTTP");
|
|
412
379
|
goto on_error;
|
|
@@ -415,7 +382,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
415
382
|
proxy_opts = &t->owner->proxy;
|
|
416
383
|
if (proxy_opts->type == GIT_PROXY_AUTO) {
|
|
417
384
|
/* Set proxy if necessary */
|
|
418
|
-
if (git_remote__get_http_proxy(t->owner->owner,
|
|
385
|
+
if (git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &proxy_url) < 0)
|
|
419
386
|
goto on_error;
|
|
420
387
|
}
|
|
421
388
|
else if (proxy_opts->type == GIT_PROXY_SPECIFIED) {
|
|
@@ -428,24 +395,38 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
428
395
|
WINHTTP_PROXY_INFO proxy_info;
|
|
429
396
|
wchar_t *proxy_wide;
|
|
430
397
|
|
|
431
|
-
|
|
398
|
+
if (!git__prefixcmp(proxy_url, SCHEME_HTTP)) {
|
|
399
|
+
t->proxy_connection_data.use_ssl = false;
|
|
400
|
+
} else if (!git__prefixcmp(proxy_url, SCHEME_HTTPS)) {
|
|
401
|
+
t->proxy_connection_data.use_ssl = true;
|
|
402
|
+
} else {
|
|
403
|
+
git_error_set(GIT_ERROR_NET, "invalid URL: '%s'", proxy_url);
|
|
404
|
+
return -1;
|
|
405
|
+
}
|
|
432
406
|
|
|
433
|
-
|
|
434
|
-
goto on_error;
|
|
407
|
+
gitno_connection_data_free_ptrs(&t->proxy_connection_data);
|
|
435
408
|
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
error = -1;
|
|
409
|
+
if ((error = gitno_extract_url_parts(&t->proxy_connection_data.host, &t->proxy_connection_data.port, NULL,
|
|
410
|
+
&t->proxy_connection_data.user, &t->proxy_connection_data.pass, proxy_url, NULL)) < 0)
|
|
439
411
|
goto on_error;
|
|
440
|
-
}
|
|
441
412
|
|
|
442
|
-
|
|
443
|
-
|
|
413
|
+
if (t->proxy_connection_data.user && t->proxy_connection_data.pass) {
|
|
414
|
+
if (t->proxy_cred) {
|
|
415
|
+
t->proxy_cred->free(t->proxy_cred);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if ((error = git_cred_userpass_plaintext_new(&t->proxy_cred, t->proxy_connection_data.user, t->proxy_connection_data.pass)) < 0)
|
|
419
|
+
goto on_error;
|
|
420
|
+
}
|
|
444
421
|
|
|
445
|
-
|
|
422
|
+
if (t->proxy_connection_data.use_ssl)
|
|
423
|
+
git_buf_PUTS(&processed_url, SCHEME_HTTPS);
|
|
424
|
+
else
|
|
425
|
+
git_buf_PUTS(&processed_url, SCHEME_HTTP);
|
|
446
426
|
|
|
447
|
-
|
|
448
|
-
|
|
427
|
+
git_buf_puts(&processed_url, t->proxy_connection_data.host);
|
|
428
|
+
if (t->proxy_connection_data.port)
|
|
429
|
+
git_buf_printf(&processed_url, ":%s", t->proxy_connection_data.port);
|
|
449
430
|
|
|
450
431
|
if (git_buf_oom(&processed_url)) {
|
|
451
432
|
error = -1;
|
|
@@ -473,8 +454,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
473
454
|
|
|
474
455
|
git__free(proxy_wide);
|
|
475
456
|
|
|
476
|
-
if (
|
|
477
|
-
|
|
457
|
+
if (t->proxy_cred) {
|
|
458
|
+
if (t->proxy_cred->credtype == GIT_CREDTYPE_USERPASS_PLAINTEXT) {
|
|
459
|
+
if ((error = apply_userpass_credential_proxy(s->request, t->proxy_cred, t->auth_mechanisms)) < 0)
|
|
460
|
+
goto on_error;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
478
464
|
}
|
|
479
465
|
|
|
480
466
|
/* Disable WinHTTP redirects so we can handle them manually. Why, you ask?
|
|
@@ -485,7 +471,6 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
485
471
|
&disable_redirects,
|
|
486
472
|
sizeof(disable_redirects))) {
|
|
487
473
|
git_error_set(GIT_ERROR_OS, "failed to disable redirects");
|
|
488
|
-
error = -1;
|
|
489
474
|
goto on_error;
|
|
490
475
|
}
|
|
491
476
|
|
|
@@ -558,16 +543,33 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
558
543
|
}
|
|
559
544
|
|
|
560
545
|
/* If requested, disable certificate validation */
|
|
561
|
-
if (
|
|
546
|
+
if (t->connection_data.use_ssl) {
|
|
562
547
|
int flags;
|
|
563
548
|
|
|
564
549
|
if (t->owner->parent.read_flags(&t->owner->parent, &flags) < 0)
|
|
565
550
|
goto on_error;
|
|
566
551
|
}
|
|
567
552
|
|
|
568
|
-
|
|
553
|
+
/* If we have a credential on the subtransport, apply it to the request */
|
|
554
|
+
if (t->cred &&
|
|
555
|
+
t->cred->credtype == GIT_CREDTYPE_USERPASS_PLAINTEXT &&
|
|
556
|
+
apply_userpass_credential(s->request, t->auth_mechanisms, t->cred) < 0)
|
|
557
|
+
goto on_error;
|
|
558
|
+
else if (t->cred &&
|
|
559
|
+
t->cred->credtype == GIT_CREDTYPE_DEFAULT &&
|
|
560
|
+
apply_default_credentials(s->request, t->auth_mechanisms) < 0)
|
|
569
561
|
goto on_error;
|
|
570
562
|
|
|
563
|
+
/* If no other credentials have been applied and the URL has username and
|
|
564
|
+
* password, use those */
|
|
565
|
+
if (!t->cred && t->connection_data.user && t->connection_data.pass) {
|
|
566
|
+
if (!t->url_cred &&
|
|
567
|
+
git_cred_userpass_plaintext_new(&t->url_cred, t->connection_data.user, t->connection_data.pass) < 0)
|
|
568
|
+
goto on_error;
|
|
569
|
+
if (apply_userpass_credential(s->request, GIT_WINHTTP_AUTH_BASIC, t->url_cred) < 0)
|
|
570
|
+
goto on_error;
|
|
571
|
+
}
|
|
572
|
+
|
|
571
573
|
/* We've done everything up to calling WinHttpSendRequest. */
|
|
572
574
|
|
|
573
575
|
error = 0;
|
|
@@ -582,9 +584,9 @@ on_error:
|
|
|
582
584
|
}
|
|
583
585
|
|
|
584
586
|
static int parse_unauthorized_response(
|
|
587
|
+
HINTERNET request,
|
|
585
588
|
int *allowed_types,
|
|
586
|
-
int *allowed_mechanisms
|
|
587
|
-
HINTERNET request)
|
|
589
|
+
int *allowed_mechanisms)
|
|
588
590
|
{
|
|
589
591
|
DWORD supported, first, target;
|
|
590
592
|
|
|
@@ -697,10 +699,6 @@ static void CALLBACK winhttp_status(
|
|
|
697
699
|
{
|
|
698
700
|
DWORD status;
|
|
699
701
|
|
|
700
|
-
GIT_UNUSED(connection);
|
|
701
|
-
GIT_UNUSED(ctx);
|
|
702
|
-
GIT_UNUSED(info_len);
|
|
703
|
-
|
|
704
702
|
if (code != WINHTTP_CALLBACK_STATUS_SECURE_FAILURE)
|
|
705
703
|
return;
|
|
706
704
|
|
|
@@ -743,12 +741,12 @@ static int winhttp_connect(
|
|
|
743
741
|
t->connection = NULL;
|
|
744
742
|
|
|
745
743
|
/* Prepare port */
|
|
746
|
-
if (git__strntol32(&port, t->
|
|
747
|
-
strlen(t->
|
|
744
|
+
if (git__strntol32(&port, t->connection_data.port,
|
|
745
|
+
strlen(t->connection_data.port), NULL, 10) < 0)
|
|
748
746
|
return -1;
|
|
749
747
|
|
|
750
748
|
/* Prepare host */
|
|
751
|
-
if (git__utf8_to_16_alloc(&wide_host, t->
|
|
749
|
+
if (git__utf8_to_16_alloc(&wide_host, t->connection_data.host) < 0) {
|
|
752
750
|
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
|
753
751
|
return -1;
|
|
754
752
|
}
|
|
@@ -831,11 +829,6 @@ static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
831
829
|
int attempts;
|
|
832
830
|
bool success;
|
|
833
831
|
|
|
834
|
-
if (len > DWORD_MAX) {
|
|
835
|
-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
836
|
-
return -1;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
832
|
for (attempts = 0; attempts < 5; attempts++) {
|
|
840
833
|
if (ignore_length) {
|
|
841
834
|
success = WinHttpSendRequest(s->request,
|
|
@@ -846,7 +839,7 @@ static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
846
839
|
success = WinHttpSendRequest(s->request,
|
|
847
840
|
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
|
|
848
841
|
WINHTTP_NO_REQUEST_DATA, 0,
|
|
849
|
-
|
|
842
|
+
len, 0);
|
|
850
843
|
}
|
|
851
844
|
|
|
852
845
|
if (success || GetLastError() != (DWORD)SEC_E_BUFFER_TOO_SMALL)
|
|
@@ -897,59 +890,6 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
897
890
|
return error;
|
|
898
891
|
}
|
|
899
892
|
|
|
900
|
-
static int acquire_credentials(
|
|
901
|
-
HINTERNET request,
|
|
902
|
-
winhttp_server *server,
|
|
903
|
-
const char *url_str,
|
|
904
|
-
git_cred_acquire_cb cred_cb,
|
|
905
|
-
void *cred_cb_payload)
|
|
906
|
-
{
|
|
907
|
-
int allowed_types;
|
|
908
|
-
int error = 1;
|
|
909
|
-
|
|
910
|
-
if (parse_unauthorized_response(&allowed_types, &server->auth_mechanisms, request) < 0)
|
|
911
|
-
return -1;
|
|
912
|
-
|
|
913
|
-
if (allowed_types) {
|
|
914
|
-
git_cred_free(server->cred);
|
|
915
|
-
server->cred = NULL;
|
|
916
|
-
|
|
917
|
-
/* Start with URL-specified credentials, if there were any. */
|
|
918
|
-
if (!server->url_cred_presented && server->url.username && server->url.password) {
|
|
919
|
-
error = acquire_url_cred(&server->cred, allowed_types, server->url.username, server->url.password);
|
|
920
|
-
server->url_cred_presented = 1;
|
|
921
|
-
|
|
922
|
-
if (error < 0)
|
|
923
|
-
return error;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/* Next use the user-defined callback, if there is one. */
|
|
927
|
-
if (error > 0 && cred_cb) {
|
|
928
|
-
error = cred_cb(&server->cred, url_str, server->url.username, allowed_types, cred_cb_payload);
|
|
929
|
-
|
|
930
|
-
/* Treat GIT_PASSTHROUGH as though git_cred_acquire_cb isn't set */
|
|
931
|
-
if (error == GIT_PASSTHROUGH)
|
|
932
|
-
error = 1;
|
|
933
|
-
else if (error < 0)
|
|
934
|
-
return error;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/* Finally, invoke the fallback default credential lookup. */
|
|
938
|
-
if (error > 0) {
|
|
939
|
-
error = acquire_fallback_cred(&server->cred, url_str, allowed_types);
|
|
940
|
-
|
|
941
|
-
if (error < 0)
|
|
942
|
-
return error;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/*
|
|
947
|
-
* No error occurred but we could not find appropriate credentials.
|
|
948
|
-
* This behaves like a pass-through.
|
|
949
|
-
*/
|
|
950
|
-
return error;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
893
|
static int winhttp_stream_read(
|
|
954
894
|
git_smart_subtransport_stream *stream,
|
|
955
895
|
char *buffer,
|
|
@@ -1016,7 +956,6 @@ replay:
|
|
|
1016
956
|
}
|
|
1017
957
|
|
|
1018
958
|
buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
|
1019
|
-
GIT_ERROR_CHECK_ALLOC(buffer);
|
|
1020
959
|
|
|
1021
960
|
while (len > 0) {
|
|
1022
961
|
DWORD bytes_written;
|
|
@@ -1075,8 +1014,7 @@ replay:
|
|
|
1075
1014
|
HTTP_STATUS_REDIRECT == status_code ||
|
|
1076
1015
|
(HTTP_STATUS_REDIRECT_METHOD == status_code &&
|
|
1077
1016
|
get_verb == s->verb) ||
|
|
1078
|
-
HTTP_STATUS_REDIRECT_KEEP_VERB == status_code
|
|
1079
|
-
HTTP_STATUS_PERMANENT_REDIRECT == status_code)) {
|
|
1017
|
+
HTTP_STATUS_REDIRECT_KEEP_VERB == status_code)) {
|
|
1080
1018
|
|
|
1081
1019
|
/* Check for Windows 7. This workaround is only necessary on
|
|
1082
1020
|
* Windows Vista and earlier. Windows 7 is version 6.1. */
|
|
@@ -1124,7 +1062,7 @@ replay:
|
|
|
1124
1062
|
|
|
1125
1063
|
if (!git__prefixcmp_icase(location8, prefix_https)) {
|
|
1126
1064
|
/* Upgrade to secure connection; disconnect and start over */
|
|
1127
|
-
if (
|
|
1065
|
+
if (gitno_connection_data_from_url(&t->connection_data, location8, s->service_url) < 0) {
|
|
1128
1066
|
git__free(location8);
|
|
1129
1067
|
return -1;
|
|
1130
1068
|
}
|
|
@@ -1139,34 +1077,67 @@ replay:
|
|
|
1139
1077
|
goto replay;
|
|
1140
1078
|
}
|
|
1141
1079
|
|
|
1142
|
-
/* Handle authentication failures */
|
|
1143
|
-
if (status_code ==
|
|
1144
|
-
int
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1080
|
+
/* Handle proxy authentication failures */
|
|
1081
|
+
if (status_code == HTTP_STATUS_PROXY_AUTH_REQ) {
|
|
1082
|
+
int allowed_types;
|
|
1083
|
+
|
|
1084
|
+
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanisms) < 0)
|
|
1085
|
+
return -1;
|
|
1086
|
+
|
|
1087
|
+
/* TODO: extract the username from the url, no payload? */
|
|
1088
|
+
if (t->owner->proxy.credentials) {
|
|
1089
|
+
int cred_error = 1;
|
|
1090
|
+
cred_error = t->owner->proxy.credentials(&t->proxy_cred, t->owner->proxy.url, NULL, allowed_types, t->owner->proxy.payload);
|
|
1091
|
+
|
|
1092
|
+
if (cred_error < 0)
|
|
1093
|
+
return cred_error;
|
|
1156
1094
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1095
|
+
|
|
1096
|
+
winhttp_stream_close(s);
|
|
1097
|
+
goto replay;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/* Handle authentication failures */
|
|
1101
|
+
if (HTTP_STATUS_DENIED == status_code && get_verb == s->verb) {
|
|
1102
|
+
int allowed_types;
|
|
1103
|
+
|
|
1104
|
+
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanisms) < 0)
|
|
1105
|
+
return -1;
|
|
1106
|
+
|
|
1107
|
+
if (allowed_types) {
|
|
1108
|
+
int cred_error = 1;
|
|
1109
|
+
|
|
1110
|
+
git_cred_free(t->cred);
|
|
1111
|
+
t->cred = NULL;
|
|
1112
|
+
/* Start with the user-supplied credential callback, if present */
|
|
1113
|
+
if (t->owner->cred_acquire_cb) {
|
|
1114
|
+
cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,
|
|
1115
|
+
t->connection_data.user, allowed_types, t->owner->cred_acquire_payload);
|
|
1116
|
+
|
|
1117
|
+
/* Treat GIT_PASSTHROUGH as though git_cred_acquire_cb isn't set */
|
|
1118
|
+
if (cred_error == GIT_PASSTHROUGH)
|
|
1119
|
+
cred_error = 1;
|
|
1120
|
+
else if (cred_error < 0)
|
|
1121
|
+
return cred_error;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/* Invoke the fallback credentials acquisition callback if necessary */
|
|
1125
|
+
if (cred_error > 0) {
|
|
1126
|
+
cred_error = fallback_cred_acquire_cb(&t->cred, t->owner->url,
|
|
1127
|
+
t->connection_data.user, allowed_types, NULL);
|
|
1128
|
+
|
|
1129
|
+
if (cred_error < 0)
|
|
1130
|
+
return cred_error;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
if (!cred_error) {
|
|
1134
|
+
assert(t->cred);
|
|
1135
|
+
|
|
1136
|
+
winhttp_stream_close(s);
|
|
1137
|
+
|
|
1138
|
+
/* Successfully acquired a credential */
|
|
1139
|
+
goto replay;
|
|
1140
|
+
}
|
|
1170
1141
|
}
|
|
1171
1142
|
}
|
|
1172
1143
|
|
|
@@ -1399,10 +1370,8 @@ static int winhttp_stream_write_chunked(
|
|
|
1399
1370
|
/* Append as much to the buffer as we can */
|
|
1400
1371
|
int count = (int)min(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
|
|
1401
1372
|
|
|
1402
|
-
if (!s->chunk_buffer)
|
|
1373
|
+
if (!s->chunk_buffer)
|
|
1403
1374
|
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
|
1404
|
-
GIT_ERROR_CHECK_ALLOC(s->chunk_buffer);
|
|
1405
|
-
}
|
|
1406
1375
|
|
|
1407
1376
|
memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
|
|
1408
1377
|
s->chunk_buffer_len += count;
|
|
@@ -1527,7 +1496,7 @@ static int winhttp_action(
|
|
|
1527
1496
|
int ret = -1;
|
|
1528
1497
|
|
|
1529
1498
|
if (!t->connection)
|
|
1530
|
-
if ((ret =
|
|
1499
|
+
if ((ret = gitno_connection_data_from_url(&t->connection_data, url, NULL)) < 0 ||
|
|
1531
1500
|
(ret = winhttp_connect(t)) < 0)
|
|
1532
1501
|
return ret;
|
|
1533
1502
|
|
|
@@ -1569,17 +1538,24 @@ static int winhttp_close(git_smart_subtransport *subtransport)
|
|
|
1569
1538
|
{
|
|
1570
1539
|
winhttp_subtransport *t = (winhttp_subtransport *)subtransport;
|
|
1571
1540
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1541
|
+
gitno_connection_data_free_ptrs(&t->connection_data);
|
|
1542
|
+
memset(&t->connection_data, 0x0, sizeof(gitno_connection_data));
|
|
1543
|
+
gitno_connection_data_free_ptrs(&t->proxy_connection_data);
|
|
1544
|
+
memset(&t->proxy_connection_data, 0x0, sizeof(gitno_connection_data));
|
|
1545
|
+
|
|
1546
|
+
if (t->cred) {
|
|
1547
|
+
t->cred->free(t->cred);
|
|
1548
|
+
t->cred = NULL;
|
|
1549
|
+
}
|
|
1574
1550
|
|
|
1575
|
-
if (t->
|
|
1576
|
-
t->
|
|
1577
|
-
t->
|
|
1551
|
+
if (t->proxy_cred) {
|
|
1552
|
+
t->proxy_cred->free(t->proxy_cred);
|
|
1553
|
+
t->proxy_cred = NULL;
|
|
1578
1554
|
}
|
|
1579
1555
|
|
|
1580
|
-
if (t->
|
|
1581
|
-
t->
|
|
1582
|
-
t->
|
|
1556
|
+
if (t->url_cred) {
|
|
1557
|
+
t->url_cred->free(t->url_cred);
|
|
1558
|
+
t->url_cred = NULL;
|
|
1583
1559
|
}
|
|
1584
1560
|
|
|
1585
1561
|
return winhttp_close_connection(t);
|