rugged 0.27.7 → 0.27.10
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 +1 -0
- data/vendor/libgit2/CMakeLists.txt +99 -51
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +149 -0
- data/vendor/libgit2/include/git2/attr.h +20 -13
- data/vendor/libgit2/include/git2/blame.h +4 -4
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/buffer.h +20 -26
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +53 -21
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +5 -5
- data/vendor/libgit2/include/git2/commit.h +25 -3
- data/vendor/libgit2/include/git2/common.h +35 -10
- data/vendor/libgit2/include/git2/config.h +29 -19
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +493 -0
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +177 -135
- data/vendor/libgit2/include/git2/errors.h +53 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/merge.h +25 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +17 -29
- data/vendor/libgit2/include/git2/odb.h +12 -11
- data/vendor/libgit2/include/git2/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +14 -3
- data/vendor/libgit2/include/git2/proxy.h +5 -3
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +34 -16
- data/vendor/libgit2/include/git2/remote.h +111 -14
- data/vendor/libgit2/include/git2/repository.h +69 -34
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +5 -5
- data/vendor/libgit2/include/git2/status.h +26 -17
- data/vendor/libgit2/include/git2/submodule.h +23 -6
- data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/merge.h +3 -3
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +14 -5
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +129 -83
- data/vendor/libgit2/include/git2/tag.h +13 -4
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -311
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +25 -106
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/include/git2.h +4 -0
- data/vendor/libgit2/src/CMakeLists.txt +104 -235
- data/vendor/libgit2/src/alloc.c +14 -18
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
- data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/annotated_commit.c +18 -11
- data/vendor/libgit2/src/apply.c +535 -28
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +77 -71
- data/vendor/libgit2/src/attr_file.c +203 -117
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +49 -51
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +38 -18
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +29 -15
- data/vendor/libgit2/src/blob.c +123 -37
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +47 -23
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +60 -53
- data/vendor/libgit2/src/cache.c +38 -45
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +20 -3
- data/vendor/libgit2/src/checkout.c +77 -67
- data/vendor/libgit2/src/cherrypick.c +12 -6
- data/vendor/libgit2/src/clone.c +36 -14
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +103 -48
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +36 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +24 -90
- data/vendor/libgit2/src/config.c +203 -176
- data/vendor/libgit2/src/config.h +8 -20
- data/vendor/libgit2/src/config_backend.h +96 -0
- data/vendor/libgit2/src/config_cache.c +41 -35
- data/vendor/libgit2/src/config_entries.c +229 -0
- data/vendor/libgit2/src/config_entries.h +24 -0
- data/vendor/libgit2/src/config_file.c +422 -680
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +96 -68
- data/vendor/libgit2/src/config_parse.h +15 -14
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -196
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +52 -67
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +44 -46
- data/vendor/libgit2/src/diff_file.c +16 -14
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +158 -103
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +34 -22
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -3
- data/vendor/libgit2/src/fetch.c +8 -3
- data/vendor/libgit2/src/fetchhead.c +12 -12
- data/vendor/libgit2/src/filebuf.c +28 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +47 -33
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +35 -55
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
- data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
- data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
- data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -21
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +107 -61
- data/vendor/libgit2/src/idxmap.h +153 -31
- data/vendor/libgit2/src/ignore.c +38 -42
- data/vendor/libgit2/src/index.c +264 -199
- data/vendor/libgit2/src/index.h +7 -1
- data/vendor/libgit2/src/indexer.c +338 -167
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +134 -62
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/mailmap.c +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +137 -93
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +24 -29
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -156
- data/vendor/libgit2/src/netops.h +3 -23
- data/vendor/libgit2/src/notes.c +14 -9
- data/vendor/libgit2/src/object.c +120 -69
- data/vendor/libgit2/src/object.h +22 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +111 -88
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +58 -47
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +17 -13
- data/vendor/libgit2/src/offmap.c +53 -35
- data/vendor/libgit2/src/offmap.h +108 -21
- data/vendor/libgit2/src/oid.c +12 -7
- data/vendor/libgit2/src/oidmap.c +49 -47
- data/vendor/libgit2/src/oidmap.h +101 -24
- data/vendor/libgit2/src/pack-objects.c +87 -86
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +94 -96
- data/vendor/libgit2/src/pack.h +16 -18
- data/vendor/libgit2/src/parse.c +17 -4
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +147 -79
- data/vendor/libgit2/src/path.c +207 -62
- data/vendor/libgit2/src/path.h +14 -0
- data/vendor/libgit2/src/pathspec.c +18 -18
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +8 -3
- data/vendor/libgit2/src/push.c +35 -29
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +97 -38
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +318 -222
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +122 -89
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +27 -33
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +229 -178
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +227 -172
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +7 -7
- data/vendor/libgit2/src/revert.c +11 -6
- data/vendor/libgit2/src/revparse.c +46 -46
- data/vendor/libgit2/src/revwalk.c +89 -54
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -9
- data/vendor/libgit2/src/signature.c +15 -13
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +56 -76
- data/vendor/libgit2/src/status.c +27 -21
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +100 -80
- data/vendor/libgit2/src/streams/mbedtls.h +5 -2
- data/vendor/libgit2/src/streams/openssl.c +93 -81
- data/vendor/libgit2/src/streams/openssl.h +5 -2
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +55 -30
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +48 -20
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +47 -74
- data/vendor/libgit2/src/strmap.h +108 -33
- data/vendor/libgit2/src/submodule.c +190 -169
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +25 -15
- data/vendor/libgit2/src/tag.c +39 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +14 -10
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/transports/git.c +25 -30
- data/vendor/libgit2/src/transports/http.c +871 -335
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +28 -28
- data/vendor/libgit2/src/transports/smart.c +64 -46
- data/vendor/libgit2/src/transports/smart.h +5 -6
- data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
- data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
- data/vendor/libgit2/src/transports/ssh.c +76 -65
- data/vendor/libgit2/src/transports/winhttp.c +328 -319
- data/vendor/libgit2/src/tree-cache.c +21 -14
- data/vendor/libgit2/src/tree.c +119 -112
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +154 -93
- data/vendor/libgit2/src/util.h +19 -23
- data/vendor/libgit2/src/vector.c +15 -10
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +9 -11
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +113 -9
- data/vendor/libgit2/src/win32/path_w32.h +18 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +69 -44
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +6 -11
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +27 -64
- data/vendor/libgit2/src/win32/w32_util.h +5 -49
- data/vendor/libgit2/src/worktree.c +44 -30
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +115 -38
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
- data/vendor/libgit2/src/streams/curl.c +0 -385
- data/vendor/libgit2/src/streams/curl.h +0 -17
- /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include "repository.h"
|
|
20
20
|
#include "global.h"
|
|
21
21
|
#include "http.h"
|
|
22
|
+
#include "git2/sys/cred.h"
|
|
22
23
|
|
|
23
24
|
#include <wincrypt.h>
|
|
24
25
|
#include <winhttp.h>
|
|
@@ -48,6 +49,14 @@
|
|
|
48
49
|
# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
|
|
49
50
|
#endif
|
|
50
51
|
|
|
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
|
+
|
|
51
60
|
static const char *prefix_https = "https://";
|
|
52
61
|
static const char *upload_pack_service = "upload-pack";
|
|
53
62
|
static const char *upload_pack_ls_service_url = "/info/refs?service=git-upload-pack";
|
|
@@ -101,23 +110,43 @@ typedef struct {
|
|
|
101
110
|
} winhttp_stream;
|
|
102
111
|
|
|
103
112
|
typedef struct {
|
|
104
|
-
|
|
105
|
-
transport_smart *owner;
|
|
106
|
-
gitno_connection_data connection_data;
|
|
107
|
-
gitno_connection_data proxy_connection_data;
|
|
113
|
+
git_net_url url;
|
|
108
114
|
git_cred *cred;
|
|
109
|
-
git_cred *url_cred;
|
|
110
|
-
git_cred *proxy_cred;
|
|
111
115
|
int auth_mechanisms;
|
|
116
|
+
bool url_cred_presented;
|
|
117
|
+
} winhttp_server;
|
|
118
|
+
|
|
119
|
+
typedef struct {
|
|
120
|
+
git_smart_subtransport parent;
|
|
121
|
+
transport_smart *owner;
|
|
122
|
+
|
|
123
|
+
winhttp_server server;
|
|
124
|
+
winhttp_server proxy;
|
|
125
|
+
|
|
112
126
|
HINTERNET session;
|
|
113
127
|
HINTERNET connection;
|
|
114
128
|
} winhttp_subtransport;
|
|
115
129
|
|
|
116
|
-
static int
|
|
130
|
+
static int apply_userpass_credentials(HINTERNET request, DWORD target, int mechanisms, git_cred *cred)
|
|
117
131
|
{
|
|
118
132
|
git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred;
|
|
119
|
-
wchar_t *user, *pass;
|
|
133
|
+
wchar_t *user = NULL, *pass = NULL;
|
|
120
134
|
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
|
+
}
|
|
121
150
|
|
|
122
151
|
if ((error = user_len = git__utf8_to_16_alloc(&user, c->username)) < 0)
|
|
123
152
|
goto done;
|
|
@@ -125,8 +154,8 @@ static int _apply_userpass_credential(HINTERNET request, DWORD target, DWORD sch
|
|
|
125
154
|
if ((error = pass_len = git__utf8_to_16_alloc(&pass, c->password)) < 0)
|
|
126
155
|
goto done;
|
|
127
156
|
|
|
128
|
-
if (!WinHttpSetCredentials(request, target,
|
|
129
|
-
|
|
157
|
+
if (!WinHttpSetCredentials(request, target, native_scheme, user, pass, NULL)) {
|
|
158
|
+
git_error_set(GIT_ERROR_OS, "failed to set credentials");
|
|
130
159
|
error = -1;
|
|
131
160
|
}
|
|
132
161
|
|
|
@@ -143,90 +172,74 @@ done:
|
|
|
143
172
|
return error;
|
|
144
173
|
}
|
|
145
174
|
|
|
146
|
-
static int
|
|
147
|
-
{
|
|
148
|
-
if (GIT_WINHTTP_AUTH_DIGEST & mechanisms) {
|
|
149
|
-
return _apply_userpass_credential(request, WINHTTP_AUTH_TARGET_PROXY,
|
|
150
|
-
WINHTTP_AUTH_SCHEME_DIGEST, cred);
|
|
151
|
-
}
|
|
152
|
-
|
|
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)
|
|
175
|
+
static int apply_default_credentials(HINTERNET request, DWORD target, int mechanisms)
|
|
158
176
|
{
|
|
159
|
-
DWORD
|
|
177
|
+
DWORD autologon_level = WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW;
|
|
178
|
+
DWORD native_scheme = 0;
|
|
160
179
|
|
|
161
|
-
if ((mechanisms &
|
|
162
|
-
|
|
180
|
+
if ((mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE) != 0) {
|
|
181
|
+
native_scheme = WINHTTP_AUTH_SCHEME_NEGOTIATE;
|
|
182
|
+
} else if ((mechanisms & GIT_WINHTTP_AUTH_NTLM) != 0) {
|
|
163
183
|
native_scheme = WINHTTP_AUTH_SCHEME_NTLM;
|
|
164
|
-
} else if (mechanisms & GIT_WINHTTP_AUTH_BASIC) {
|
|
165
|
-
native_scheme = WINHTTP_AUTH_SCHEME_BASIC;
|
|
166
184
|
} else {
|
|
167
|
-
|
|
185
|
+
git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
|
|
168
186
|
return -1;
|
|
169
187
|
}
|
|
170
188
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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;
|
|
191
|
-
|
|
192
|
-
if (!native_scheme) {
|
|
193
|
-
giterr_set(GITERR_NET, "invalid authentication scheme");
|
|
189
|
+
/*
|
|
190
|
+
* Autologon policy must be "low" to use default creds.
|
|
191
|
+
* This is safe as the user has explicitly requested it.
|
|
192
|
+
*/
|
|
193
|
+
if (!WinHttpSetOption(request, WINHTTP_OPTION_AUTOLOGON_POLICY, &autologon_level, sizeof(DWORD))) {
|
|
194
|
+
git_error_set(GIT_ERROR_OS, "could not configure logon policy");
|
|
194
195
|
return -1;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
if (!
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (!WinHttpSetCredentials(request, WINHTTP_AUTH_TARGET_SERVER, native_scheme, NULL, NULL, NULL))
|
|
198
|
+
if (!WinHttpSetCredentials(request, target, native_scheme, NULL, NULL, NULL)) {
|
|
199
|
+
git_error_set(GIT_ERROR_OS, "could not configure credentials");
|
|
201
200
|
return -1;
|
|
201
|
+
}
|
|
202
202
|
|
|
203
203
|
return 0;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
static int
|
|
206
|
+
static int acquire_url_cred(
|
|
207
207
|
git_cred **cred,
|
|
208
|
-
const char *url,
|
|
209
|
-
const char *username_from_url,
|
|
210
208
|
unsigned int allowed_types,
|
|
211
|
-
|
|
209
|
+
const char *username,
|
|
210
|
+
const char *password)
|
|
212
211
|
{
|
|
213
|
-
|
|
212
|
+
if (allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)
|
|
213
|
+
return git_cred_userpass_plaintext_new(cred, username, password);
|
|
214
|
+
|
|
215
|
+
if ((allowed_types & GIT_CREDTYPE_DEFAULT) && *username == '\0' && *password == '\0')
|
|
216
|
+
return git_cred_default_new(cred);
|
|
214
217
|
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static int acquire_fallback_cred(
|
|
222
|
+
git_cred **cred,
|
|
223
|
+
const char *url,
|
|
224
|
+
unsigned int allowed_types)
|
|
225
|
+
{
|
|
226
|
+
int error = 1;
|
|
217
227
|
|
|
218
228
|
/* If the target URI supports integrated Windows authentication
|
|
219
229
|
* as an authentication mechanism */
|
|
220
230
|
if (GIT_CREDTYPE_DEFAULT & allowed_types) {
|
|
221
231
|
wchar_t *wide_url;
|
|
232
|
+
HRESULT hCoInitResult;
|
|
222
233
|
|
|
223
234
|
/* Convert URL to wide characters */
|
|
224
235
|
if (git__utf8_to_16_alloc(&wide_url, url) < 0) {
|
|
225
|
-
|
|
236
|
+
git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
|
|
226
237
|
return -1;
|
|
227
238
|
}
|
|
228
239
|
|
|
229
|
-
|
|
240
|
+
hCoInitResult = CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
241
|
+
|
|
242
|
+
if (SUCCEEDED(hCoInitResult) || hCoInitResult == RPC_E_CHANGED_MODE) {
|
|
230
243
|
IInternetSecurityManager* pISM;
|
|
231
244
|
|
|
232
245
|
/* And if the target URI is in the My Computer, Intranet, or Trusted zones */
|
|
@@ -250,7 +263,9 @@ static int fallback_cred_acquire_cb(
|
|
|
250
263
|
pISM->lpVtbl->Release(pISM);
|
|
251
264
|
}
|
|
252
265
|
|
|
253
|
-
|
|
266
|
+
/* Only unitialize if the call to CoInitializeEx was successful. */
|
|
267
|
+
if (SUCCEEDED(hCoInitResult))
|
|
268
|
+
CoUninitialize();
|
|
254
269
|
}
|
|
255
270
|
|
|
256
271
|
git__free(wide_url);
|
|
@@ -269,29 +284,32 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
|
269
284
|
|
|
270
285
|
/* If there is no override, we should fail if WinHTTP doesn't think it's fine */
|
|
271
286
|
if (t->owner->certificate_check_cb == NULL && !valid) {
|
|
272
|
-
if (!
|
|
273
|
-
|
|
287
|
+
if (!git_error_last())
|
|
288
|
+
git_error_set(GIT_ERROR_NET, "unknown certificate check failure");
|
|
274
289
|
|
|
275
290
|
return GIT_ECERTIFICATE;
|
|
276
291
|
}
|
|
277
292
|
|
|
278
|
-
if (t->owner->certificate_check_cb == NULL ||
|
|
293
|
+
if (t->owner->certificate_check_cb == NULL || git__strcmp(t->server.url.scheme, "https") != 0)
|
|
279
294
|
return 0;
|
|
280
295
|
|
|
281
296
|
if (!WinHttpQueryOption(s->request, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert_ctx, &cert_ctx_size)) {
|
|
282
|
-
|
|
297
|
+
git_error_set(GIT_ERROR_OS, "failed to get server certificate");
|
|
283
298
|
return -1;
|
|
284
299
|
}
|
|
285
300
|
|
|
286
|
-
|
|
301
|
+
git_error_clear();
|
|
287
302
|
cert.parent.cert_type = GIT_CERT_X509;
|
|
288
303
|
cert.data = cert_ctx->pbCertEncoded;
|
|
289
304
|
cert.len = cert_ctx->cbCertEncoded;
|
|
290
|
-
error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->
|
|
305
|
+
error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->server.url.host, t->owner->message_cb_payload);
|
|
291
306
|
CertFreeCertificateContext(cert_ctx);
|
|
292
307
|
|
|
293
|
-
if (error
|
|
294
|
-
|
|
308
|
+
if (error == GIT_PASSTHROUGH)
|
|
309
|
+
error = valid ? 0 : GIT_ECERTIFICATE;
|
|
310
|
+
|
|
311
|
+
if (error < 0 && !git_error_last())
|
|
312
|
+
git_error_set(GIT_ERROR_NET, "user cancelled certificate check");
|
|
295
313
|
|
|
296
314
|
return error;
|
|
297
315
|
}
|
|
@@ -321,37 +339,26 @@ static void winhttp_stream_close(winhttp_stream *s)
|
|
|
321
339
|
s->sent_request = 0;
|
|
322
340
|
}
|
|
323
341
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
*
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const wchar_t *url, int url_len)
|
|
342
|
+
static int apply_credentials(
|
|
343
|
+
HINTERNET request,
|
|
344
|
+
git_net_url *url,
|
|
345
|
+
int target,
|
|
346
|
+
git_cred *creds,
|
|
347
|
+
int mechanisms)
|
|
331
348
|
{
|
|
332
|
-
|
|
349
|
+
int error = 0;
|
|
333
350
|
|
|
334
|
-
|
|
335
|
-
/* These tell WinHttpCrackUrl that we're interested in the fields */
|
|
336
|
-
components.dwUserNameLength = 1;
|
|
337
|
-
components.dwPasswordLength = 1;
|
|
338
|
-
|
|
339
|
-
if (!WinHttpCrackUrl(url, url_len, 0, &components)) {
|
|
340
|
-
giterr_set(GITERR_OS, "failed to extract user/pass from url");
|
|
341
|
-
return -1;
|
|
342
|
-
}
|
|
351
|
+
GIT_UNUSED(url);
|
|
343
352
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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);
|
|
348
358
|
|
|
349
|
-
return
|
|
359
|
+
return error;
|
|
350
360
|
}
|
|
351
361
|
|
|
352
|
-
#define SCHEME_HTTP "http://"
|
|
353
|
-
#define SCHEME_HTTPS "https://"
|
|
354
|
-
|
|
355
362
|
static int winhttp_stream_connect(winhttp_stream *s)
|
|
356
363
|
{
|
|
357
364
|
winhttp_subtransport *t = OWNING_SUBTRANSPORT(s);
|
|
@@ -364,18 +371,20 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
364
371
|
unsigned long disable_redirects = WINHTTP_DISABLE_REDIRECTS;
|
|
365
372
|
int default_timeout = TIMEOUT_INFINITE;
|
|
366
373
|
int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
|
374
|
+
DWORD autologon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH;
|
|
375
|
+
|
|
367
376
|
size_t i;
|
|
368
377
|
const git_proxy_options *proxy_opts;
|
|
369
378
|
|
|
370
379
|
/* Prepare URL */
|
|
371
|
-
git_buf_printf(&buf, "%s%s", t->
|
|
380
|
+
git_buf_printf(&buf, "%s%s", t->server.url.path, s->service_url);
|
|
372
381
|
|
|
373
382
|
if (git_buf_oom(&buf))
|
|
374
383
|
return -1;
|
|
375
384
|
|
|
376
385
|
/* Convert URL to wide characters */
|
|
377
386
|
if (git__utf8_to_16_alloc(&s->request_uri, git_buf_cstr(&buf)) < 0) {
|
|
378
|
-
|
|
387
|
+
git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
|
|
379
388
|
goto on_error;
|
|
380
389
|
}
|
|
381
390
|
|
|
@@ -387,27 +396,31 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
387
396
|
NULL,
|
|
388
397
|
WINHTTP_NO_REFERER,
|
|
389
398
|
types,
|
|
390
|
-
t->
|
|
399
|
+
git__strcmp(t->server.url.scheme, "https") == 0 ? WINHTTP_FLAG_SECURE : 0);
|
|
391
400
|
|
|
392
401
|
if (!s->request) {
|
|
393
|
-
|
|
402
|
+
git_error_set(GIT_ERROR_OS, "failed to open request");
|
|
394
403
|
goto on_error;
|
|
395
404
|
}
|
|
396
405
|
|
|
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
|
+
|
|
397
410
|
if (!WinHttpSetTimeouts(s->request, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
|
|
398
|
-
|
|
411
|
+
git_error_set(GIT_ERROR_OS, "failed to set timeouts for WinHTTP");
|
|
399
412
|
goto on_error;
|
|
400
413
|
}
|
|
401
414
|
|
|
402
415
|
proxy_opts = &t->owner->proxy;
|
|
403
416
|
if (proxy_opts->type == GIT_PROXY_AUTO) {
|
|
404
417
|
/* Set proxy if necessary */
|
|
405
|
-
if (git_remote__get_http_proxy(t->owner->owner,
|
|
418
|
+
if (git_remote__get_http_proxy(t->owner->owner, (strcmp(t->server.url.scheme, "https") == 0), &proxy_url) < 0)
|
|
406
419
|
goto on_error;
|
|
407
420
|
}
|
|
408
421
|
else if (proxy_opts->type == GIT_PROXY_SPECIFIED) {
|
|
409
422
|
proxy_url = git__strdup(proxy_opts->url);
|
|
410
|
-
|
|
423
|
+
GIT_ERROR_CHECK_ALLOC(proxy_url);
|
|
411
424
|
}
|
|
412
425
|
|
|
413
426
|
if (proxy_url) {
|
|
@@ -415,38 +428,24 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
415
428
|
WINHTTP_PROXY_INFO proxy_info;
|
|
416
429
|
wchar_t *proxy_wide;
|
|
417
430
|
|
|
418
|
-
|
|
419
|
-
t->proxy_connection_data.use_ssl = false;
|
|
420
|
-
} else if (!git__prefixcmp(proxy_url, SCHEME_HTTPS)) {
|
|
421
|
-
t->proxy_connection_data.use_ssl = true;
|
|
422
|
-
} else {
|
|
423
|
-
giterr_set(GITERR_NET, "invalid URL: '%s'", proxy_url);
|
|
424
|
-
return -1;
|
|
425
|
-
}
|
|
431
|
+
git_net_url_dispose(&t->proxy.url);
|
|
426
432
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if ((error = gitno_extract_url_parts(&t->proxy_connection_data.host, &t->proxy_connection_data.port, NULL,
|
|
430
|
-
&t->proxy_connection_data.user, &t->proxy_connection_data.pass, proxy_url, NULL)) < 0)
|
|
433
|
+
if ((error = git_net_url_parse(&t->proxy.url, proxy_url)) < 0)
|
|
431
434
|
goto on_error;
|
|
432
435
|
|
|
433
|
-
if (t->
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if ((error = git_cred_userpass_plaintext_new(&t->proxy_cred, t->proxy_connection_data.user, t->proxy_connection_data.pass)) < 0)
|
|
439
|
-
goto on_error;
|
|
436
|
+
if (strcmp(t->proxy.url.scheme, "http") != 0 && strcmp(t->proxy.url.scheme, "https") != 0) {
|
|
437
|
+
git_error_set(GIT_ERROR_NET, "invalid URL: '%s'", proxy_url);
|
|
438
|
+
error = -1;
|
|
439
|
+
goto on_error;
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
else
|
|
445
|
-
git_buf_PUTS(&processed_url, SCHEME_HTTP);
|
|
442
|
+
git_buf_puts(&processed_url, t->proxy.url.scheme);
|
|
443
|
+
git_buf_PUTS(&processed_url, "://");
|
|
446
444
|
|
|
447
|
-
git_buf_puts(&processed_url, t->
|
|
448
|
-
|
|
449
|
-
|
|
445
|
+
git_buf_puts(&processed_url, t->proxy.url.host);
|
|
446
|
+
|
|
447
|
+
if (!git_net_url_is_default_port(&t->proxy.url))
|
|
448
|
+
git_buf_printf(&processed_url, ":%s", t->proxy.url.port);
|
|
450
449
|
|
|
451
450
|
if (git_buf_oom(&processed_url)) {
|
|
452
451
|
error = -1;
|
|
@@ -467,20 +466,15 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
467
466
|
WINHTTP_OPTION_PROXY,
|
|
468
467
|
&proxy_info,
|
|
469
468
|
sizeof(WINHTTP_PROXY_INFO))) {
|
|
470
|
-
|
|
469
|
+
git_error_set(GIT_ERROR_OS, "failed to set proxy");
|
|
471
470
|
git__free(proxy_wide);
|
|
472
471
|
goto on_error;
|
|
473
472
|
}
|
|
474
473
|
|
|
475
474
|
git__free(proxy_wide);
|
|
476
475
|
|
|
477
|
-
if (t->
|
|
478
|
-
|
|
479
|
-
if ((error = apply_userpass_credential_proxy(s->request, t->proxy_cred, t->auth_mechanisms)) < 0)
|
|
480
|
-
goto on_error;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
476
|
+
if ((error = apply_credentials(s->request, &t->proxy.url, WINHTTP_AUTH_TARGET_PROXY, t->proxy.cred, t->proxy.auth_mechanisms)) < 0)
|
|
477
|
+
goto on_error;
|
|
484
478
|
}
|
|
485
479
|
|
|
486
480
|
/* Disable WinHTTP redirects so we can handle them manually. Why, you ask?
|
|
@@ -490,7 +484,8 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
490
484
|
WINHTTP_OPTION_DISABLE_FEATURE,
|
|
491
485
|
&disable_redirects,
|
|
492
486
|
sizeof(disable_redirects))) {
|
|
493
|
-
|
|
487
|
+
git_error_set(GIT_ERROR_OS, "failed to disable redirects");
|
|
488
|
+
error = -1;
|
|
494
489
|
goto on_error;
|
|
495
490
|
}
|
|
496
491
|
|
|
@@ -504,7 +499,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
504
499
|
|
|
505
500
|
/* Send Pragma: no-cache header */
|
|
506
501
|
if (!WinHttpAddRequestHeaders(s->request, pragma_nocache, (ULONG) -1L, WINHTTP_ADDREQ_FLAG_ADD)) {
|
|
507
|
-
|
|
502
|
+
git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
|
|
508
503
|
goto on_error;
|
|
509
504
|
}
|
|
510
505
|
|
|
@@ -517,13 +512,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
517
512
|
goto on_error;
|
|
518
513
|
|
|
519
514
|
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
|
|
520
|
-
|
|
515
|
+
git_error_set(GIT_ERROR_OS, "failed to convert content-type to wide characters");
|
|
521
516
|
goto on_error;
|
|
522
517
|
}
|
|
523
518
|
|
|
524
519
|
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
|
|
525
520
|
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
|
|
526
|
-
|
|
521
|
+
git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
|
|
527
522
|
goto on_error;
|
|
528
523
|
}
|
|
529
524
|
|
|
@@ -534,13 +529,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
534
529
|
goto on_error;
|
|
535
530
|
|
|
536
531
|
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
|
|
537
|
-
|
|
532
|
+
git_error_set(GIT_ERROR_OS, "failed to convert accept header to wide characters");
|
|
538
533
|
goto on_error;
|
|
539
534
|
}
|
|
540
535
|
|
|
541
536
|
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
|
|
542
537
|
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
|
|
543
|
-
|
|
538
|
+
git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
|
|
544
539
|
goto on_error;
|
|
545
540
|
}
|
|
546
541
|
}
|
|
@@ -550,46 +545,29 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
|
550
545
|
git_buf_clear(&buf);
|
|
551
546
|
git_buf_puts(&buf, t->owner->custom_headers.strings[i]);
|
|
552
547
|
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
|
|
553
|
-
|
|
548
|
+
git_error_set(GIT_ERROR_OS, "failed to convert custom header to wide characters");
|
|
554
549
|
goto on_error;
|
|
555
550
|
}
|
|
556
551
|
|
|
557
552
|
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
|
|
558
553
|
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
|
|
559
|
-
|
|
554
|
+
git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
|
|
560
555
|
goto on_error;
|
|
561
556
|
}
|
|
562
557
|
}
|
|
563
558
|
}
|
|
564
559
|
|
|
565
560
|
/* If requested, disable certificate validation */
|
|
566
|
-
if (t->
|
|
561
|
+
if (strcmp(t->server.url.scheme, "https") == 0) {
|
|
567
562
|
int flags;
|
|
568
563
|
|
|
569
564
|
if (t->owner->parent.read_flags(&t->owner->parent, &flags) < 0)
|
|
570
565
|
goto on_error;
|
|
571
566
|
}
|
|
572
567
|
|
|
573
|
-
|
|
574
|
-
if (t->cred &&
|
|
575
|
-
t->cred->credtype == GIT_CREDTYPE_USERPASS_PLAINTEXT &&
|
|
576
|
-
apply_userpass_credential(s->request, t->auth_mechanisms, t->cred) < 0)
|
|
577
|
-
goto on_error;
|
|
578
|
-
else if (t->cred &&
|
|
579
|
-
t->cred->credtype == GIT_CREDTYPE_DEFAULT &&
|
|
580
|
-
apply_default_credentials(s->request, t->auth_mechanisms) < 0)
|
|
568
|
+
if ((error = apply_credentials(s->request, &t->server.url, WINHTTP_AUTH_TARGET_SERVER, t->server.cred, t->server.auth_mechanisms)) < 0)
|
|
581
569
|
goto on_error;
|
|
582
570
|
|
|
583
|
-
/* If no other credentials have been applied and the URL has username and
|
|
584
|
-
* password, use those */
|
|
585
|
-
if (!t->cred && t->connection_data.user && t->connection_data.pass) {
|
|
586
|
-
if (!t->url_cred &&
|
|
587
|
-
git_cred_userpass_plaintext_new(&t->url_cred, t->connection_data.user, t->connection_data.pass) < 0)
|
|
588
|
-
goto on_error;
|
|
589
|
-
if (apply_userpass_credential(s->request, GIT_WINHTTP_AUTH_BASIC, t->url_cred) < 0)
|
|
590
|
-
goto on_error;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
571
|
/* We've done everything up to calling WinHttpSendRequest. */
|
|
594
572
|
|
|
595
573
|
error = 0;
|
|
@@ -604,9 +582,9 @@ on_error:
|
|
|
604
582
|
}
|
|
605
583
|
|
|
606
584
|
static int parse_unauthorized_response(
|
|
607
|
-
HINTERNET request,
|
|
608
585
|
int *allowed_types,
|
|
609
|
-
int *allowed_mechanisms
|
|
586
|
+
int *allowed_mechanisms,
|
|
587
|
+
HINTERNET request)
|
|
610
588
|
{
|
|
611
589
|
DWORD supported, first, target;
|
|
612
590
|
|
|
@@ -617,7 +595,7 @@ static int parse_unauthorized_response(
|
|
|
617
595
|
* We can assume this was already done, since we know we are unauthorized.
|
|
618
596
|
*/
|
|
619
597
|
if (!WinHttpQueryAuthSchemes(request, &supported, &first, &target)) {
|
|
620
|
-
|
|
598
|
+
git_error_set(GIT_ERROR_OS, "failed to parse supported auth schemes");
|
|
621
599
|
return -1;
|
|
622
600
|
}
|
|
623
601
|
|
|
@@ -651,7 +629,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
|
|
|
651
629
|
git_buf buf = GIT_BUF_INIT;
|
|
652
630
|
|
|
653
631
|
/* Chunk header */
|
|
654
|
-
git_buf_printf(&buf, "%
|
|
632
|
+
git_buf_printf(&buf, "%"PRIXZ"\r\n", len);
|
|
655
633
|
|
|
656
634
|
if (git_buf_oom(&buf))
|
|
657
635
|
return -1;
|
|
@@ -660,7 +638,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
|
|
|
660
638
|
git_buf_cstr(&buf), (DWORD)git_buf_len(&buf),
|
|
661
639
|
&bytes_written)) {
|
|
662
640
|
git_buf_dispose(&buf);
|
|
663
|
-
|
|
641
|
+
git_error_set(GIT_ERROR_OS, "failed to write chunk header");
|
|
664
642
|
return -1;
|
|
665
643
|
}
|
|
666
644
|
|
|
@@ -670,7 +648,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
|
|
|
670
648
|
if (!WinHttpWriteData(request,
|
|
671
649
|
buffer, (DWORD)len,
|
|
672
650
|
&bytes_written)) {
|
|
673
|
-
|
|
651
|
+
git_error_set(GIT_ERROR_OS, "failed to write chunk");
|
|
674
652
|
return -1;
|
|
675
653
|
}
|
|
676
654
|
|
|
@@ -678,7 +656,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
|
|
|
678
656
|
if (!WinHttpWriteData(request,
|
|
679
657
|
"\r\n", 2,
|
|
680
658
|
&bytes_written)) {
|
|
681
|
-
|
|
659
|
+
git_error_set(GIT_ERROR_OS, "failed to write chunk footer");
|
|
682
660
|
return -1;
|
|
683
661
|
}
|
|
684
662
|
|
|
@@ -691,7 +669,7 @@ static int winhttp_close_connection(winhttp_subtransport *t)
|
|
|
691
669
|
|
|
692
670
|
if (t->connection) {
|
|
693
671
|
if (!WinHttpCloseHandle(t->connection)) {
|
|
694
|
-
|
|
672
|
+
git_error_set(GIT_ERROR_OS, "unable to close connection");
|
|
695
673
|
ret = -1;
|
|
696
674
|
}
|
|
697
675
|
|
|
@@ -700,7 +678,7 @@ static int winhttp_close_connection(winhttp_subtransport *t)
|
|
|
700
678
|
|
|
701
679
|
if (t->session) {
|
|
702
680
|
if (!WinHttpCloseHandle(t->session)) {
|
|
703
|
-
|
|
681
|
+
git_error_set(GIT_ERROR_OS, "unable to close session");
|
|
704
682
|
ret = -1;
|
|
705
683
|
}
|
|
706
684
|
|
|
@@ -719,27 +697,31 @@ static void CALLBACK winhttp_status(
|
|
|
719
697
|
{
|
|
720
698
|
DWORD status;
|
|
721
699
|
|
|
700
|
+
GIT_UNUSED(connection);
|
|
701
|
+
GIT_UNUSED(ctx);
|
|
702
|
+
GIT_UNUSED(info_len);
|
|
703
|
+
|
|
722
704
|
if (code != WINHTTP_CALLBACK_STATUS_SECURE_FAILURE)
|
|
723
705
|
return;
|
|
724
706
|
|
|
725
707
|
status = *((DWORD *)info);
|
|
726
708
|
|
|
727
709
|
if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID))
|
|
728
|
-
|
|
710
|
+
git_error_set(GIT_ERROR_NET, "SSL certificate issued for different common name");
|
|
729
711
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID))
|
|
730
|
-
|
|
712
|
+
git_error_set(GIT_ERROR_NET, "SSL certificate has expired");
|
|
731
713
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA))
|
|
732
|
-
|
|
714
|
+
git_error_set(GIT_ERROR_NET, "SSL certificate signed by unknown CA");
|
|
733
715
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT))
|
|
734
|
-
|
|
716
|
+
git_error_set(GIT_ERROR_NET, "SSL certificate is invalid");
|
|
735
717
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED))
|
|
736
|
-
|
|
718
|
+
git_error_set(GIT_ERROR_NET, "certificate revocation check failed");
|
|
737
719
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED))
|
|
738
|
-
|
|
720
|
+
git_error_set(GIT_ERROR_NET, "SSL certificate was revoked");
|
|
739
721
|
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR))
|
|
740
|
-
|
|
722
|
+
git_error_set(GIT_ERROR_NET, "security libraries could not be loaded");
|
|
741
723
|
else
|
|
742
|
-
|
|
724
|
+
git_error_set(GIT_ERROR_NET, "unknown security error %lu", status);
|
|
743
725
|
}
|
|
744
726
|
|
|
745
727
|
static int winhttp_connect(
|
|
@@ -761,12 +743,13 @@ static int winhttp_connect(
|
|
|
761
743
|
t->connection = NULL;
|
|
762
744
|
|
|
763
745
|
/* Prepare port */
|
|
764
|
-
if (
|
|
746
|
+
if (git__strntol32(&port, t->server.url.port,
|
|
747
|
+
strlen(t->server.url.port), NULL, 10) < 0)
|
|
765
748
|
return -1;
|
|
766
749
|
|
|
767
750
|
/* Prepare host */
|
|
768
|
-
if (git__utf8_to_16_alloc(&wide_host, t->
|
|
769
|
-
|
|
751
|
+
if (git__utf8_to_16_alloc(&wide_host, t->server.url.host) < 0) {
|
|
752
|
+
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
|
770
753
|
return -1;
|
|
771
754
|
}
|
|
772
755
|
|
|
@@ -777,7 +760,7 @@ static int winhttp_connect(
|
|
|
777
760
|
}
|
|
778
761
|
|
|
779
762
|
if (git__utf8_to_16_alloc(&wide_ua, git_buf_cstr(&ua)) < 0) {
|
|
780
|
-
|
|
763
|
+
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
|
781
764
|
git__free(wide_host);
|
|
782
765
|
git_buf_dispose(&ua);
|
|
783
766
|
return -1;
|
|
@@ -794,7 +777,7 @@ static int winhttp_connect(
|
|
|
794
777
|
0);
|
|
795
778
|
|
|
796
779
|
if (!t->session) {
|
|
797
|
-
|
|
780
|
+
git_error_set(GIT_ERROR_OS, "failed to init WinHTTP");
|
|
798
781
|
goto on_error;
|
|
799
782
|
}
|
|
800
783
|
|
|
@@ -809,7 +792,7 @@ static int winhttp_connect(
|
|
|
809
792
|
sizeof(protocols));
|
|
810
793
|
|
|
811
794
|
if (!WinHttpSetTimeouts(t->session, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
|
|
812
|
-
|
|
795
|
+
git_error_set(GIT_ERROR_OS, "failed to set timeouts for WinHTTP");
|
|
813
796
|
goto on_error;
|
|
814
797
|
}
|
|
815
798
|
|
|
@@ -822,12 +805,12 @@ static int winhttp_connect(
|
|
|
822
805
|
0);
|
|
823
806
|
|
|
824
807
|
if (!t->connection) {
|
|
825
|
-
|
|
808
|
+
git_error_set(GIT_ERROR_OS, "failed to connect to host");
|
|
826
809
|
goto on_error;
|
|
827
810
|
}
|
|
828
811
|
|
|
829
812
|
if (WinHttpSetStatusCallback(t->connection, winhttp_status, WINHTTP_CALLBACK_FLAG_SECURE_FAILURE, 0) == WINHTTP_INVALID_STATUS_CALLBACK) {
|
|
830
|
-
|
|
813
|
+
git_error_set(GIT_ERROR_OS, "failed to set status callback");
|
|
831
814
|
goto on_error;
|
|
832
815
|
}
|
|
833
816
|
|
|
@@ -845,23 +828,32 @@ on_error:
|
|
|
845
828
|
|
|
846
829
|
static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
847
830
|
{
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
831
|
+
int attempts;
|
|
832
|
+
bool success;
|
|
833
|
+
|
|
834
|
+
if (len > DWORD_MAX) {
|
|
835
|
+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
836
|
+
return -1;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
for (attempts = 0; attempts < 5; attempts++) {
|
|
840
|
+
if (ignore_length) {
|
|
841
|
+
success = WinHttpSendRequest(s->request,
|
|
842
|
+
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
|
|
843
|
+
WINHTTP_NO_REQUEST_DATA, 0,
|
|
844
|
+
WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH, 0);
|
|
845
|
+
} else {
|
|
846
|
+
success = WinHttpSendRequest(s->request,
|
|
847
|
+
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
|
|
848
|
+
WINHTTP_NO_REQUEST_DATA, 0,
|
|
849
|
+
(DWORD)len, 0);
|
|
861
850
|
}
|
|
851
|
+
|
|
852
|
+
if (success || GetLastError() != (DWORD)SEC_E_BUFFER_TOO_SMALL)
|
|
853
|
+
break;
|
|
862
854
|
}
|
|
863
855
|
|
|
864
|
-
return 0;
|
|
856
|
+
return success ? 0 : -1;
|
|
865
857
|
}
|
|
866
858
|
|
|
867
859
|
static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
@@ -869,10 +861,10 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
869
861
|
int request_failed = 0, cert_valid = 1, error = 0;
|
|
870
862
|
DWORD ignore_flags;
|
|
871
863
|
|
|
872
|
-
|
|
864
|
+
git_error_clear();
|
|
873
865
|
if ((error = do_send_request(s, len, ignore_length)) < 0) {
|
|
874
866
|
if (GetLastError() != ERROR_WINHTTP_SECURE_FAILURE) {
|
|
875
|
-
|
|
867
|
+
git_error_set(GIT_ERROR_OS, "failed to send request");
|
|
876
868
|
return -1;
|
|
877
869
|
}
|
|
878
870
|
|
|
@@ -880,10 +872,10 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
880
872
|
cert_valid = 0;
|
|
881
873
|
}
|
|
882
874
|
|
|
883
|
-
|
|
875
|
+
git_error_clear();
|
|
884
876
|
if ((error = certificate_check(s, cert_valid)) < 0) {
|
|
885
|
-
if (!
|
|
886
|
-
|
|
877
|
+
if (!git_error_last())
|
|
878
|
+
git_error_set(GIT_ERROR_OS, "user cancelled certificate check");
|
|
887
879
|
|
|
888
880
|
return error;
|
|
889
881
|
}
|
|
@@ -895,16 +887,69 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
|
|
895
887
|
ignore_flags = no_check_cert_flags;
|
|
896
888
|
|
|
897
889
|
if (!WinHttpSetOption(s->request, WINHTTP_OPTION_SECURITY_FLAGS, &ignore_flags, sizeof(ignore_flags))) {
|
|
898
|
-
|
|
890
|
+
git_error_set(GIT_ERROR_OS, "failed to set security options");
|
|
899
891
|
return -1;
|
|
900
892
|
}
|
|
901
893
|
|
|
902
894
|
if ((error = do_send_request(s, len, ignore_length)) < 0)
|
|
903
|
-
|
|
895
|
+
git_error_set(GIT_ERROR_OS, "failed to send request with unchecked certificate");
|
|
904
896
|
|
|
905
897
|
return error;
|
|
906
898
|
}
|
|
907
899
|
|
|
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
|
+
|
|
908
953
|
static int winhttp_stream_read(
|
|
909
954
|
git_smart_subtransport_stream *stream,
|
|
910
955
|
char *buffer,
|
|
@@ -919,8 +964,8 @@ static int winhttp_stream_read(
|
|
|
919
964
|
|
|
920
965
|
replay:
|
|
921
966
|
/* Enforce a reasonable cap on the number of replays */
|
|
922
|
-
if (++
|
|
923
|
-
|
|
967
|
+
if (replay_count++ >= GIT_HTTP_REPLAY_MAX) {
|
|
968
|
+
git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
|
|
924
969
|
return -1;
|
|
925
970
|
}
|
|
926
971
|
|
|
@@ -955,7 +1000,7 @@ replay:
|
|
|
955
1000
|
if (!WinHttpWriteData(s->request,
|
|
956
1001
|
"0\r\n\r\n", 5,
|
|
957
1002
|
&bytes_written)) {
|
|
958
|
-
|
|
1003
|
+
git_error_set(GIT_ERROR_OS, "failed to write final chunk");
|
|
959
1004
|
return -1;
|
|
960
1005
|
}
|
|
961
1006
|
}
|
|
@@ -966,11 +1011,12 @@ replay:
|
|
|
966
1011
|
if (INVALID_SET_FILE_POINTER == SetFilePointer(s->post_body,
|
|
967
1012
|
0, 0, FILE_BEGIN) &&
|
|
968
1013
|
NO_ERROR != GetLastError()) {
|
|
969
|
-
|
|
1014
|
+
git_error_set(GIT_ERROR_OS, "failed to reset file pointer");
|
|
970
1015
|
return -1;
|
|
971
1016
|
}
|
|
972
1017
|
|
|
973
1018
|
buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
|
1019
|
+
GIT_ERROR_CHECK_ALLOC(buffer);
|
|
974
1020
|
|
|
975
1021
|
while (len > 0) {
|
|
976
1022
|
DWORD bytes_written;
|
|
@@ -980,14 +1026,14 @@ replay:
|
|
|
980
1026
|
&bytes_read, NULL) ||
|
|
981
1027
|
!bytes_read) {
|
|
982
1028
|
git__free(buffer);
|
|
983
|
-
|
|
1029
|
+
git_error_set(GIT_ERROR_OS, "failed to read from temp file");
|
|
984
1030
|
return -1;
|
|
985
1031
|
}
|
|
986
1032
|
|
|
987
1033
|
if (!WinHttpWriteData(s->request, buffer,
|
|
988
1034
|
bytes_read, &bytes_written)) {
|
|
989
1035
|
git__free(buffer);
|
|
990
|
-
|
|
1036
|
+
git_error_set(GIT_ERROR_OS, "failed to write data");
|
|
991
1037
|
return -1;
|
|
992
1038
|
}
|
|
993
1039
|
|
|
@@ -1003,7 +1049,7 @@ replay:
|
|
|
1003
1049
|
}
|
|
1004
1050
|
|
|
1005
1051
|
if (!WinHttpReceiveResponse(s->request, 0)) {
|
|
1006
|
-
|
|
1052
|
+
git_error_set(GIT_ERROR_OS, "failed to receive response");
|
|
1007
1053
|
return -1;
|
|
1008
1054
|
}
|
|
1009
1055
|
|
|
@@ -1015,7 +1061,7 @@ replay:
|
|
|
1015
1061
|
WINHTTP_HEADER_NAME_BY_INDEX,
|
|
1016
1062
|
&status_code, &status_code_length,
|
|
1017
1063
|
WINHTTP_NO_HEADER_INDEX)) {
|
|
1018
|
-
|
|
1064
|
+
git_error_set(GIT_ERROR_OS, "failed to retrieve status code");
|
|
1019
1065
|
return -1;
|
|
1020
1066
|
}
|
|
1021
1067
|
|
|
@@ -1029,7 +1075,8 @@ replay:
|
|
|
1029
1075
|
HTTP_STATUS_REDIRECT == status_code ||
|
|
1030
1076
|
(HTTP_STATUS_REDIRECT_METHOD == status_code &&
|
|
1031
1077
|
get_verb == s->verb) ||
|
|
1032
|
-
HTTP_STATUS_REDIRECT_KEEP_VERB == status_code
|
|
1078
|
+
HTTP_STATUS_REDIRECT_KEEP_VERB == status_code ||
|
|
1079
|
+
HTTP_STATUS_PERMANENT_REDIRECT == status_code)) {
|
|
1033
1080
|
|
|
1034
1081
|
/* Check for Windows 7. This workaround is only necessary on
|
|
1035
1082
|
* Windows Vista and earlier. Windows 7 is version 6.1. */
|
|
@@ -1045,12 +1092,12 @@ replay:
|
|
|
1045
1092
|
&location_length,
|
|
1046
1093
|
WINHTTP_NO_HEADER_INDEX) ||
|
|
1047
1094
|
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
|
1048
|
-
|
|
1095
|
+
git_error_set(GIT_ERROR_OS, "failed to read Location header");
|
|
1049
1096
|
return -1;
|
|
1050
1097
|
}
|
|
1051
1098
|
|
|
1052
1099
|
location = git__malloc(location_length);
|
|
1053
|
-
|
|
1100
|
+
GIT_ERROR_CHECK_ALLOC(location);
|
|
1054
1101
|
|
|
1055
1102
|
if (!WinHttpQueryHeaders(s->request,
|
|
1056
1103
|
WINHTTP_QUERY_LOCATION,
|
|
@@ -1058,14 +1105,14 @@ replay:
|
|
|
1058
1105
|
location,
|
|
1059
1106
|
&location_length,
|
|
1060
1107
|
WINHTTP_NO_HEADER_INDEX)) {
|
|
1061
|
-
|
|
1108
|
+
git_error_set(GIT_ERROR_OS, "failed to read Location header");
|
|
1062
1109
|
git__free(location);
|
|
1063
1110
|
return -1;
|
|
1064
1111
|
}
|
|
1065
1112
|
|
|
1066
1113
|
/* Convert the Location header to UTF-8 */
|
|
1067
1114
|
if (git__utf16_to_8_alloc(&location8, location) < 0) {
|
|
1068
|
-
|
|
1115
|
+
git_error_set(GIT_ERROR_OS, "failed to convert Location header to UTF-8");
|
|
1069
1116
|
git__free(location);
|
|
1070
1117
|
return -1;
|
|
1071
1118
|
}
|
|
@@ -1077,7 +1124,7 @@ replay:
|
|
|
1077
1124
|
|
|
1078
1125
|
if (!git__prefixcmp_icase(location8, prefix_https)) {
|
|
1079
1126
|
/* Upgrade to secure connection; disconnect and start over */
|
|
1080
|
-
if (
|
|
1127
|
+
if (gitno_connection_data_handle_redirect(&t->server.url, location8, s->service_url) < 0) {
|
|
1081
1128
|
git__free(location8);
|
|
1082
1129
|
return -1;
|
|
1083
1130
|
}
|
|
@@ -1092,72 +1139,39 @@ replay:
|
|
|
1092
1139
|
goto replay;
|
|
1093
1140
|
}
|
|
1094
1141
|
|
|
1095
|
-
/* Handle proxy authentication failures */
|
|
1096
|
-
if (status_code == HTTP_STATUS_PROXY_AUTH_REQ) {
|
|
1097
|
-
int allowed_types;
|
|
1098
|
-
|
|
1099
|
-
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanisms) < 0)
|
|
1100
|
-
return -1;
|
|
1101
|
-
|
|
1102
|
-
/* TODO: extract the username from the url, no payload? */
|
|
1103
|
-
if (t->owner->proxy.credentials) {
|
|
1104
|
-
int cred_error = 1;
|
|
1105
|
-
cred_error = t->owner->proxy.credentials(&t->proxy_cred, t->owner->proxy.url, NULL, allowed_types, t->owner->proxy.payload);
|
|
1106
|
-
|
|
1107
|
-
if (cred_error < 0)
|
|
1108
|
-
return cred_error;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
winhttp_stream_close(s);
|
|
1112
|
-
goto replay;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
1142
|
/* Handle authentication failures */
|
|
1116
|
-
if (
|
|
1117
|
-
int
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
t->cred
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if (cred_error < 0)
|
|
1145
|
-
return cred_error;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
if (!cred_error) {
|
|
1149
|
-
assert(t->cred);
|
|
1150
|
-
|
|
1151
|
-
winhttp_stream_close(s);
|
|
1152
|
-
|
|
1153
|
-
/* Successfully acquired a credential */
|
|
1154
|
-
goto replay;
|
|
1155
|
-
}
|
|
1143
|
+
if (status_code == HTTP_STATUS_DENIED) {
|
|
1144
|
+
int error = acquire_credentials(s->request,
|
|
1145
|
+
&t->server,
|
|
1146
|
+
t->owner->url,
|
|
1147
|
+
t->owner->cred_acquire_cb,
|
|
1148
|
+
t->owner->cred_acquire_payload);
|
|
1149
|
+
|
|
1150
|
+
if (error < 0) {
|
|
1151
|
+
return error;
|
|
1152
|
+
} else if (!error) {
|
|
1153
|
+
assert(t->server.cred);
|
|
1154
|
+
winhttp_stream_close(s);
|
|
1155
|
+
goto replay;
|
|
1156
|
+
}
|
|
1157
|
+
} else if (status_code == HTTP_STATUS_PROXY_AUTH_REQ) {
|
|
1158
|
+
int error = acquire_credentials(s->request,
|
|
1159
|
+
&t->proxy,
|
|
1160
|
+
t->owner->proxy.url,
|
|
1161
|
+
t->owner->proxy.credentials,
|
|
1162
|
+
t->owner->proxy.payload);
|
|
1163
|
+
|
|
1164
|
+
if (error < 0) {
|
|
1165
|
+
return error;
|
|
1166
|
+
} else if (!error) {
|
|
1167
|
+
assert(t->proxy.cred);
|
|
1168
|
+
winhttp_stream_close(s);
|
|
1169
|
+
goto replay;
|
|
1156
1170
|
}
|
|
1157
1171
|
}
|
|
1158
1172
|
|
|
1159
1173
|
if (HTTP_STATUS_OK != status_code) {
|
|
1160
|
-
|
|
1174
|
+
git_error_set(GIT_ERROR_NET, "request failed with status code: %lu", status_code);
|
|
1161
1175
|
return -1;
|
|
1162
1176
|
}
|
|
1163
1177
|
|
|
@@ -1168,7 +1182,7 @@ replay:
|
|
|
1168
1182
|
p_snprintf(expected_content_type_8, MAX_CONTENT_TYPE_LEN, "application/x-git-%s-advertisement", s->service);
|
|
1169
1183
|
|
|
1170
1184
|
if (git__utf8_to_16(expected_content_type, MAX_CONTENT_TYPE_LEN, expected_content_type_8) < 0) {
|
|
1171
|
-
|
|
1185
|
+
git_error_set(GIT_ERROR_OS, "failed to convert expected content-type to wide characters");
|
|
1172
1186
|
return -1;
|
|
1173
1187
|
}
|
|
1174
1188
|
|
|
@@ -1179,12 +1193,12 @@ replay:
|
|
|
1179
1193
|
WINHTTP_HEADER_NAME_BY_INDEX,
|
|
1180
1194
|
&content_type, &content_type_length,
|
|
1181
1195
|
WINHTTP_NO_HEADER_INDEX)) {
|
|
1182
|
-
|
|
1196
|
+
git_error_set(GIT_ERROR_OS, "failed to retrieve response content-type");
|
|
1183
1197
|
return -1;
|
|
1184
1198
|
}
|
|
1185
1199
|
|
|
1186
1200
|
if (wcscmp(expected_content_type, content_type)) {
|
|
1187
|
-
|
|
1201
|
+
git_error_set(GIT_ERROR_NET, "received unexpected content-type");
|
|
1188
1202
|
return -1;
|
|
1189
1203
|
}
|
|
1190
1204
|
|
|
@@ -1196,7 +1210,7 @@ replay:
|
|
|
1196
1210
|
(DWORD)buf_size,
|
|
1197
1211
|
&dw_bytes_read))
|
|
1198
1212
|
{
|
|
1199
|
-
|
|
1213
|
+
git_error_set(GIT_ERROR_OS, "failed to read data");
|
|
1200
1214
|
return -1;
|
|
1201
1215
|
}
|
|
1202
1216
|
|
|
@@ -1219,7 +1233,7 @@ static int winhttp_stream_write_single(
|
|
|
1219
1233
|
|
|
1220
1234
|
/* This implementation of write permits only a single call. */
|
|
1221
1235
|
if (s->sent_request) {
|
|
1222
|
-
|
|
1236
|
+
git_error_set(GIT_ERROR_NET, "subtransport configured for only one write");
|
|
1223
1237
|
return -1;
|
|
1224
1238
|
}
|
|
1225
1239
|
|
|
@@ -1232,7 +1246,7 @@ static int winhttp_stream_write_single(
|
|
|
1232
1246
|
(LPCVOID)buffer,
|
|
1233
1247
|
(DWORD)len,
|
|
1234
1248
|
&bytes_written)) {
|
|
1235
|
-
|
|
1249
|
+
git_error_set(GIT_ERROR_OS, "failed to write data");
|
|
1236
1250
|
return -1;
|
|
1237
1251
|
}
|
|
1238
1252
|
|
|
@@ -1250,12 +1264,12 @@ static int put_uuid_string(LPWSTR buffer, size_t buffer_len_cch)
|
|
|
1250
1264
|
if (RPC_S_OK != status &&
|
|
1251
1265
|
RPC_S_UUID_LOCAL_ONLY != status &&
|
|
1252
1266
|
RPC_S_UUID_NO_ADDRESS != status) {
|
|
1253
|
-
|
|
1267
|
+
git_error_set(GIT_ERROR_NET, "unable to generate name for temp file");
|
|
1254
1268
|
return -1;
|
|
1255
1269
|
}
|
|
1256
1270
|
|
|
1257
1271
|
if (buffer_len_cch < UUID_LENGTH_CCH + 1) {
|
|
1258
|
-
|
|
1272
|
+
git_error_set(GIT_ERROR_NET, "buffer too small for name of temp file");
|
|
1259
1273
|
return -1;
|
|
1260
1274
|
}
|
|
1261
1275
|
|
|
@@ -1270,7 +1284,7 @@ static int put_uuid_string(LPWSTR buffer, size_t buffer_len_cch)
|
|
|
1270
1284
|
uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7]);
|
|
1271
1285
|
|
|
1272
1286
|
if (result < UUID_LENGTH_CCH) {
|
|
1273
|
-
|
|
1287
|
+
git_error_set(GIT_ERROR_OS, "unable to generate name for temp file");
|
|
1274
1288
|
return -1;
|
|
1275
1289
|
}
|
|
1276
1290
|
|
|
@@ -1282,7 +1296,7 @@ static int get_temp_file(LPWSTR buffer, DWORD buffer_len_cch)
|
|
|
1282
1296
|
size_t len;
|
|
1283
1297
|
|
|
1284
1298
|
if (!GetTempPathW(buffer_len_cch, buffer)) {
|
|
1285
|
-
|
|
1299
|
+
git_error_set(GIT_ERROR_OS, "failed to get temp path");
|
|
1286
1300
|
return -1;
|
|
1287
1301
|
}
|
|
1288
1302
|
|
|
@@ -1325,13 +1339,13 @@ static int winhttp_stream_write_buffered(
|
|
|
1325
1339
|
|
|
1326
1340
|
if (INVALID_HANDLE_VALUE == s->post_body) {
|
|
1327
1341
|
s->post_body = NULL;
|
|
1328
|
-
|
|
1342
|
+
git_error_set(GIT_ERROR_OS, "failed to create temporary file");
|
|
1329
1343
|
return -1;
|
|
1330
1344
|
}
|
|
1331
1345
|
}
|
|
1332
1346
|
|
|
1333
1347
|
if (!WriteFile(s->post_body, buffer, (DWORD)len, &bytes_written, NULL)) {
|
|
1334
|
-
|
|
1348
|
+
git_error_set(GIT_ERROR_OS, "failed to write to temporary file");
|
|
1335
1349
|
return -1;
|
|
1336
1350
|
}
|
|
1337
1351
|
|
|
@@ -1358,7 +1372,7 @@ static int winhttp_stream_write_chunked(
|
|
|
1358
1372
|
if (!WinHttpAddRequestHeaders(s->request,
|
|
1359
1373
|
transfer_encoding, (ULONG) -1L,
|
|
1360
1374
|
WINHTTP_ADDREQ_FLAG_ADD)) {
|
|
1361
|
-
|
|
1375
|
+
git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
|
|
1362
1376
|
return -1;
|
|
1363
1377
|
}
|
|
1364
1378
|
|
|
@@ -1385,8 +1399,10 @@ static int winhttp_stream_write_chunked(
|
|
|
1385
1399
|
/* Append as much to the buffer as we can */
|
|
1386
1400
|
int count = (int)min(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
|
|
1387
1401
|
|
|
1388
|
-
if (!s->chunk_buffer)
|
|
1402
|
+
if (!s->chunk_buffer) {
|
|
1389
1403
|
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
|
1404
|
+
GIT_ERROR_CHECK_ALLOC(s->chunk_buffer);
|
|
1405
|
+
}
|
|
1390
1406
|
|
|
1391
1407
|
memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
|
|
1392
1408
|
s->chunk_buffer_len += count;
|
|
@@ -1427,7 +1443,7 @@ static int winhttp_stream_alloc(winhttp_subtransport *t, winhttp_stream **stream
|
|
|
1427
1443
|
return -1;
|
|
1428
1444
|
|
|
1429
1445
|
s = git__calloc(1, sizeof(winhttp_stream));
|
|
1430
|
-
|
|
1446
|
+
GIT_ERROR_CHECK_ALLOC(s);
|
|
1431
1447
|
|
|
1432
1448
|
s->parent.subtransport = &t->parent;
|
|
1433
1449
|
s->parent.read = winhttp_stream_read;
|
|
@@ -1511,7 +1527,7 @@ static int winhttp_action(
|
|
|
1511
1527
|
int ret = -1;
|
|
1512
1528
|
|
|
1513
1529
|
if (!t->connection)
|
|
1514
|
-
if ((ret =
|
|
1530
|
+
if ((ret = git_net_url_parse(&t->server.url, url)) < 0 ||
|
|
1515
1531
|
(ret = winhttp_connect(t)) < 0)
|
|
1516
1532
|
return ret;
|
|
1517
1533
|
|
|
@@ -1553,24 +1569,17 @@ static int winhttp_close(git_smart_subtransport *subtransport)
|
|
|
1553
1569
|
{
|
|
1554
1570
|
winhttp_subtransport *t = (winhttp_subtransport *)subtransport;
|
|
1555
1571
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
gitno_connection_data_free_ptrs(&t->proxy_connection_data);
|
|
1559
|
-
memset(&t->proxy_connection_data, 0x0, sizeof(gitno_connection_data));
|
|
1560
|
-
|
|
1561
|
-
if (t->cred) {
|
|
1562
|
-
t->cred->free(t->cred);
|
|
1563
|
-
t->cred = NULL;
|
|
1564
|
-
}
|
|
1572
|
+
git_net_url_dispose(&t->server.url);
|
|
1573
|
+
git_net_url_dispose(&t->proxy.url);
|
|
1565
1574
|
|
|
1566
|
-
if (t->
|
|
1567
|
-
t->
|
|
1568
|
-
t->
|
|
1575
|
+
if (t->server.cred) {
|
|
1576
|
+
t->server.cred->free(t->server.cred);
|
|
1577
|
+
t->server.cred = NULL;
|
|
1569
1578
|
}
|
|
1570
1579
|
|
|
1571
|
-
if (t->
|
|
1572
|
-
t->
|
|
1573
|
-
t->
|
|
1580
|
+
if (t->proxy.cred) {
|
|
1581
|
+
t->proxy.cred->free(t->proxy.cred);
|
|
1582
|
+
t->proxy.cred = NULL;
|
|
1574
1583
|
}
|
|
1575
1584
|
|
|
1576
1585
|
return winhttp_close_connection(t);
|
|
@@ -1595,7 +1604,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
|
|
|
1595
1604
|
return -1;
|
|
1596
1605
|
|
|
1597
1606
|
t = git__calloc(1, sizeof(winhttp_subtransport));
|
|
1598
|
-
|
|
1607
|
+
GIT_ERROR_CHECK_ALLOC(t);
|
|
1599
1608
|
|
|
1600
1609
|
t->owner = (transport_smart *)owner;
|
|
1601
1610
|
t->parent.action = winhttp_action;
|