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.
Files changed (350) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +0 -1
  4. data/vendor/libgit2/CMakeLists.txt +16 -36
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
  7. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  8. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  10. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  11. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  12. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  13. data/vendor/libgit2/deps/regex/COPYING +502 -0
  14. data/vendor/libgit2/deps/regex/config.h +7 -0
  15. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  16. data/vendor/libgit2/deps/regex/regex.c +92 -0
  17. data/vendor/libgit2/deps/regex/regex.h +582 -0
  18. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  19. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  20. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  21. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  22. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  23. data/vendor/libgit2/include/git2.h +0 -2
  24. data/vendor/libgit2/include/git2/apply.h +2 -22
  25. data/vendor/libgit2/include/git2/attr.h +12 -19
  26. data/vendor/libgit2/include/git2/blame.h +2 -2
  27. data/vendor/libgit2/include/git2/blob.h +12 -44
  28. data/vendor/libgit2/include/git2/buffer.h +14 -20
  29. data/vendor/libgit2/include/git2/checkout.h +14 -46
  30. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  31. data/vendor/libgit2/include/git2/clone.h +2 -2
  32. data/vendor/libgit2/include/git2/commit.h +1 -23
  33. data/vendor/libgit2/include/git2/common.h +5 -7
  34. data/vendor/libgit2/include/git2/config.h +12 -12
  35. data/vendor/libgit2/include/git2/deprecated.h +3 -243
  36. data/vendor/libgit2/include/git2/describe.h +4 -4
  37. data/vendor/libgit2/include/git2/diff.h +14 -16
  38. data/vendor/libgit2/include/git2/filter.h +0 -8
  39. data/vendor/libgit2/include/git2/index.h +1 -2
  40. data/vendor/libgit2/include/git2/indexer.h +4 -48
  41. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  42. data/vendor/libgit2/include/git2/merge.h +10 -6
  43. data/vendor/libgit2/include/git2/net.h +5 -0
  44. data/vendor/libgit2/include/git2/object.h +14 -2
  45. data/vendor/libgit2/include/git2/odb.h +2 -3
  46. data/vendor/libgit2/include/git2/odb_backend.h +4 -5
  47. data/vendor/libgit2/include/git2/oid.h +1 -1
  48. data/vendor/libgit2/include/git2/pack.h +1 -12
  49. data/vendor/libgit2/include/git2/proxy.h +3 -5
  50. data/vendor/libgit2/include/git2/rebase.h +2 -46
  51. data/vendor/libgit2/include/git2/refs.h +0 -19
  52. data/vendor/libgit2/include/git2/remote.h +12 -35
  53. data/vendor/libgit2/include/git2/repository.h +2 -24
  54. data/vendor/libgit2/include/git2/revert.h +1 -1
  55. data/vendor/libgit2/include/git2/stash.h +3 -3
  56. data/vendor/libgit2/include/git2/status.h +16 -25
  57. data/vendor/libgit2/include/git2/submodule.h +3 -20
  58. data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
  59. data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
  60. data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
  61. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  62. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  63. data/vendor/libgit2/include/git2/sys/transport.h +2 -2
  64. data/vendor/libgit2/include/git2/tag.h +2 -11
  65. data/vendor/libgit2/include/git2/trace.h +2 -2
  66. data/vendor/libgit2/include/git2/transport.h +340 -11
  67. data/vendor/libgit2/include/git2/tree.h +1 -1
  68. data/vendor/libgit2/include/git2/types.h +89 -4
  69. data/vendor/libgit2/include/git2/version.h +2 -2
  70. data/vendor/libgit2/include/git2/worktree.h +5 -5
  71. data/vendor/libgit2/libgit2.pc.in +13 -0
  72. data/vendor/libgit2/src/CMakeLists.txt +222 -88
  73. data/vendor/libgit2/src/alloc.c +14 -2
  74. data/vendor/libgit2/src/apply.c +30 -60
  75. data/vendor/libgit2/src/attr.c +64 -70
  76. data/vendor/libgit2/src/attr_file.c +96 -189
  77. data/vendor/libgit2/src/attr_file.h +9 -9
  78. data/vendor/libgit2/src/attrcache.c +46 -44
  79. data/vendor/libgit2/src/attrcache.h +1 -2
  80. data/vendor/libgit2/src/blame.c +5 -17
  81. data/vendor/libgit2/src/blame.h +1 -1
  82. data/vendor/libgit2/src/blame_git.c +7 -21
  83. data/vendor/libgit2/src/blob.c +17 -81
  84. data/vendor/libgit2/src/blob.h +2 -2
  85. data/vendor/libgit2/src/branch.c +5 -29
  86. data/vendor/libgit2/src/buffer.c +7 -14
  87. data/vendor/libgit2/src/cache.c +33 -26
  88. data/vendor/libgit2/src/cache.h +1 -1
  89. data/vendor/libgit2/src/cc-compat.h +0 -5
  90. data/vendor/libgit2/src/checkout.c +16 -26
  91. data/vendor/libgit2/src/cherrypick.c +3 -9
  92. data/vendor/libgit2/src/clone.c +7 -29
  93. data/vendor/libgit2/src/clone.h +0 -4
  94. data/vendor/libgit2/src/commit.c +21 -69
  95. data/vendor/libgit2/src/commit.h +0 -6
  96. data/vendor/libgit2/src/commit_list.c +76 -28
  97. data/vendor/libgit2/src/commit_list.h +2 -2
  98. data/vendor/libgit2/src/common.h +75 -3
  99. data/vendor/libgit2/src/config.c +40 -31
  100. data/vendor/libgit2/src/config.h +6 -7
  101. data/vendor/libgit2/src/config_backend.h +0 -12
  102. data/vendor/libgit2/src/config_cache.c +39 -39
  103. data/vendor/libgit2/src/config_entries.c +99 -69
  104. data/vendor/libgit2/src/config_entries.h +0 -1
  105. data/vendor/libgit2/src/config_file.c +380 -337
  106. data/vendor/libgit2/src/config_mem.c +16 -12
  107. data/vendor/libgit2/src/config_parse.c +29 -49
  108. data/vendor/libgit2/src/config_parse.h +12 -13
  109. data/vendor/libgit2/src/crlf.c +14 -14
  110. data/vendor/libgit2/src/describe.c +20 -21
  111. data/vendor/libgit2/src/diff.c +58 -43
  112. data/vendor/libgit2/src/diff.h +1 -2
  113. data/vendor/libgit2/src/diff_driver.c +38 -37
  114. data/vendor/libgit2/src/diff_file.c +7 -9
  115. data/vendor/libgit2/src/diff_file.h +1 -1
  116. data/vendor/libgit2/src/diff_generate.c +85 -135
  117. data/vendor/libgit2/src/diff_generate.h +2 -2
  118. data/vendor/libgit2/src/diff_parse.c +1 -1
  119. data/vendor/libgit2/src/diff_print.c +13 -25
  120. data/vendor/libgit2/src/diff_stats.c +1 -1
  121. data/vendor/libgit2/src/diff_tform.c +4 -4
  122. data/vendor/libgit2/src/errors.c +22 -12
  123. data/vendor/libgit2/src/features.h.in +2 -9
  124. data/vendor/libgit2/src/fetch.c +2 -7
  125. data/vendor/libgit2/src/fetchhead.c +1 -1
  126. data/vendor/libgit2/src/filebuf.c +10 -6
  127. data/vendor/libgit2/src/filebuf.h +2 -2
  128. data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
  129. data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
  130. data/vendor/libgit2/src/filter.c +8 -16
  131. data/vendor/libgit2/src/fnmatch.c +248 -0
  132. data/vendor/libgit2/src/fnmatch.h +48 -0
  133. data/vendor/libgit2/src/global.c +40 -12
  134. data/vendor/libgit2/src/global.h +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -61
  136. data/vendor/libgit2/src/hash.h +21 -19
  137. data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
  138. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
  139. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  140. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
  141. data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
  142. data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
  143. data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
  144. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
  145. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  146. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  147. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  148. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  149. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  150. data/vendor/libgit2/src/hashsig.c +1 -1
  151. data/vendor/libgit2/src/idxmap.c +65 -91
  152. data/vendor/libgit2/src/idxmap.h +15 -151
  153. data/vendor/libgit2/src/ignore.c +38 -32
  154. data/vendor/libgit2/src/index.c +43 -66
  155. data/vendor/libgit2/src/index.h +1 -1
  156. data/vendor/libgit2/src/indexer.c +70 -69
  157. data/vendor/libgit2/src/integer.h +4 -39
  158. data/vendor/libgit2/src/iterator.c +22 -27
  159. data/vendor/libgit2/src/map.h +1 -1
  160. data/vendor/libgit2/src/merge.c +44 -58
  161. data/vendor/libgit2/src/merge_driver.c +4 -4
  162. data/vendor/libgit2/src/merge_file.c +1 -1
  163. data/vendor/libgit2/src/mwindow.c +23 -18
  164. data/vendor/libgit2/src/mwindow.h +4 -4
  165. data/vendor/libgit2/src/netops.c +165 -55
  166. data/vendor/libgit2/src/netops.h +25 -3
  167. data/vendor/libgit2/src/notes.c +2 -2
  168. data/vendor/libgit2/src/object.c +2 -2
  169. data/vendor/libgit2/src/object.h +0 -2
  170. data/vendor/libgit2/src/odb.c +23 -41
  171. data/vendor/libgit2/src/odb.h +2 -3
  172. data/vendor/libgit2/src/odb_loose.c +10 -17
  173. data/vendor/libgit2/src/odb_mempack.c +23 -10
  174. data/vendor/libgit2/src/odb_pack.c +4 -4
  175. data/vendor/libgit2/src/offmap.c +55 -43
  176. data/vendor/libgit2/src/offmap.h +24 -102
  177. data/vendor/libgit2/src/oid.c +1 -6
  178. data/vendor/libgit2/src/oidmap.c +57 -39
  179. data/vendor/libgit2/src/oidmap.h +19 -99
  180. data/vendor/libgit2/src/pack-objects.c +32 -25
  181. data/vendor/libgit2/src/pack-objects.h +1 -1
  182. data/vendor/libgit2/src/pack.c +47 -45
  183. data/vendor/libgit2/src/pack.h +14 -12
  184. data/vendor/libgit2/src/parse.c +0 -10
  185. data/vendor/libgit2/src/parse.h +3 -3
  186. data/vendor/libgit2/src/patch.c +1 -1
  187. data/vendor/libgit2/src/patch_generate.c +2 -2
  188. data/vendor/libgit2/src/patch_parse.c +31 -124
  189. data/vendor/libgit2/src/path.c +6 -43
  190. data/vendor/libgit2/src/path.h +0 -2
  191. data/vendor/libgit2/src/pathspec.c +13 -13
  192. data/vendor/libgit2/src/pool.c +22 -26
  193. data/vendor/libgit2/src/pool.h +7 -7
  194. data/vendor/libgit2/src/posix.c +7 -7
  195. data/vendor/libgit2/src/posix.h +1 -12
  196. data/vendor/libgit2/src/proxy.c +2 -7
  197. data/vendor/libgit2/src/push.c +5 -10
  198. data/vendor/libgit2/src/reader.c +2 -2
  199. data/vendor/libgit2/src/rebase.c +7 -66
  200. data/vendor/libgit2/src/refdb.c +0 -12
  201. data/vendor/libgit2/src/refdb_fs.c +165 -214
  202. data/vendor/libgit2/src/reflog.c +13 -11
  203. data/vendor/libgit2/src/refs.c +18 -24
  204. data/vendor/libgit2/src/refspec.c +16 -9
  205. data/vendor/libgit2/src/remote.c +52 -50
  206. data/vendor/libgit2/src/remote.h +2 -2
  207. data/vendor/libgit2/src/repository.c +100 -115
  208. data/vendor/libgit2/src/repository.h +40 -49
  209. data/vendor/libgit2/src/revert.c +3 -8
  210. data/vendor/libgit2/src/revparse.c +19 -18
  211. data/vendor/libgit2/src/revwalk.c +30 -63
  212. data/vendor/libgit2/src/revwalk.h +0 -20
  213. data/vendor/libgit2/src/settings.c +0 -5
  214. data/vendor/libgit2/src/sortedcache.c +26 -12
  215. data/vendor/libgit2/src/sortedcache.h +1 -1
  216. data/vendor/libgit2/src/stash.c +65 -45
  217. data/vendor/libgit2/src/status.c +9 -15
  218. data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
  219. data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
  220. data/vendor/libgit2/src/streams/openssl.c +0 -20
  221. data/vendor/libgit2/src/streams/socket.c +2 -2
  222. data/vendor/libgit2/src/strmap.c +84 -37
  223. data/vendor/libgit2/src/strmap.h +33 -105
  224. data/vendor/libgit2/src/submodule.c +70 -102
  225. data/vendor/libgit2/src/submodule.h +1 -1
  226. data/vendor/libgit2/src/sysdir.c +1 -11
  227. data/vendor/libgit2/src/tag.c +2 -10
  228. data/vendor/libgit2/src/trace.c +1 -1
  229. data/vendor/libgit2/src/trace.h +2 -2
  230. data/vendor/libgit2/src/trailer.c +32 -46
  231. data/vendor/libgit2/src/transaction.c +9 -10
  232. data/vendor/libgit2/src/transports/auth.c +9 -10
  233. data/vendor/libgit2/src/transports/auth.h +4 -11
  234. data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
  235. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  236. data/vendor/libgit2/src/transports/cred.c +6 -6
  237. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  238. data/vendor/libgit2/src/transports/git.c +16 -11
  239. data/vendor/libgit2/src/transports/http.c +276 -419
  240. data/vendor/libgit2/src/transports/http.h +1 -1
  241. data/vendor/libgit2/src/transports/local.c +9 -9
  242. data/vendor/libgit2/src/transports/smart.c +17 -17
  243. data/vendor/libgit2/src/transports/smart.h +2 -2
  244. data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
  245. data/vendor/libgit2/src/transports/ssh.c +36 -46
  246. data/vendor/libgit2/src/transports/winhttp.c +207 -231
  247. data/vendor/libgit2/src/tree-cache.c +7 -14
  248. data/vendor/libgit2/src/tree.c +24 -10
  249. data/vendor/libgit2/src/unix/map.c +1 -1
  250. data/vendor/libgit2/src/unix/posix.h +11 -1
  251. data/vendor/libgit2/src/userdiff.h +1 -3
  252. data/vendor/libgit2/src/util.c +53 -51
  253. data/vendor/libgit2/src/util.h +21 -16
  254. data/vendor/libgit2/src/win32/map.c +5 -3
  255. data/vendor/libgit2/src/win32/path_w32.c +2 -12
  256. data/vendor/libgit2/src/win32/path_w32.h +29 -0
  257. data/vendor/libgit2/src/win32/posix.h +4 -1
  258. data/vendor/libgit2/src/win32/posix_w32.c +5 -40
  259. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  260. data/vendor/libgit2/src/win32/thread.c +10 -5
  261. data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
  262. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
  263. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
  264. data/vendor/libgit2/src/win32/w32_stack.c +9 -4
  265. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  266. data/vendor/libgit2/src/win32/w32_util.c +0 -31
  267. data/vendor/libgit2/src/win32/w32_util.h +32 -6
  268. data/vendor/libgit2/src/worktree.c +22 -36
  269. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
  270. data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
  271. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  272. metadata +34 -98
  273. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  274. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  275. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  276. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  277. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  278. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  279. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  280. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  281. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  282. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  283. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  284. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  285. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  286. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  287. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  288. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  289. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  290. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  291. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  292. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  293. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  294. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  295. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  296. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  297. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  298. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  299. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  300. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  301. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  302. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  303. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  304. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  305. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  306. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  307. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  308. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  309. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  310. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  311. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  312. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  313. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  314. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  315. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  316. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  317. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  318. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  319. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  320. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  321. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  322. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  323. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  324. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  325. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  326. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  327. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  328. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  329. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  330. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  331. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  332. data/vendor/libgit2/include/git2/cert.h +0 -135
  333. data/vendor/libgit2/include/git2/cred.h +0 -308
  334. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  335. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  336. data/vendor/libgit2/src/config_snapshot.c +0 -206
  337. data/vendor/libgit2/src/errors.h +0 -81
  338. data/vendor/libgit2/src/hash/sha1.h +0 -38
  339. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  340. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  341. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  342. data/vendor/libgit2/src/net.c +0 -184
  343. data/vendor/libgit2/src/net.h +0 -36
  344. data/vendor/libgit2/src/regexp.c +0 -221
  345. data/vendor/libgit2/src/regexp.h +0 -97
  346. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  347. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  348. data/vendor/libgit2/src/wildmatch.c +0 -320
  349. data/vendor/libgit2/src/wildmatch.h +0 -23
  350. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -12,11 +12,11 @@
12
12
  #include "git2.h"
13
13
  #include "auth.h"
14
14
 
15
- #if defined(GIT_GSSAPI) || defined(GIT_GSSFRAMEWORK)
15
+ #ifdef GIT_GSSAPI
16
16
 
17
17
  extern int git_http_auth_negotiate(
18
18
  git_http_auth_context **out,
19
- const git_net_url *url);
19
+ const gitno_connection_data *connection_data);
20
20
 
21
21
  #else
22
22
 
@@ -5,10 +5,10 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "cred.h"
9
9
 
10
- #include "git2/cred.h"
11
- #include "git2/sys/cred.h"
10
+ #include "git2.h"
11
+ #include "smart.h"
12
12
  #include "git2/cred_helpers.h"
13
13
 
14
14
  static int git_cred_ssh_key_type_new(
@@ -27,7 +27,7 @@ int git_cred_has_username(git_cred *cred)
27
27
  return 1;
28
28
  }
29
29
 
30
- const char *git_cred_get_username(git_cred *cred)
30
+ const char *git_cred__username(git_cred *cred)
31
31
  {
32
32
  switch (cred->credtype) {
33
33
  case GIT_CREDTYPE_USERNAME:
@@ -264,7 +264,7 @@ static int git_cred_ssh_key_type_new(
264
264
  int git_cred_ssh_interactive_new(
265
265
  git_cred **out,
266
266
  const char *username,
267
- git_cred_ssh_interactive_cb prompt_callback,
267
+ git_cred_ssh_interactive_callback prompt_callback,
268
268
  void *payload)
269
269
  {
270
270
  git_cred_ssh_interactive *c;
@@ -312,7 +312,7 @@ int git_cred_ssh_custom_new(
312
312
  const char *username,
313
313
  const char *publickey,
314
314
  size_t publickey_len,
315
- git_cred_sign_cb sign_callback,
315
+ git_cred_sign_callback sign_callback,
316
316
  void *payload)
317
317
  {
318
318
  git_cred_ssh_custom *c;
@@ -4,14 +4,13 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
-
8
- #ifndef INCLUDE_allocators_crtdbg_h
9
- #define INCLUDE_allocators_crtdbg_h
7
+ #ifndef INCLUDE_transports_cred_h__
8
+ #define INCLUDE_transports_cred_h__
10
9
 
11
10
  #include "common.h"
12
11
 
13
- #include "alloc.h"
12
+ #include "git2/transport.h"
14
13
 
15
- int git_win32_crtdbg_init_allocator(git_allocator *allocator);
14
+ const char *git_cred__username(git_cred *cred);
16
15
 
17
16
  #endif
@@ -192,9 +192,8 @@ static int _git_uploadpack_ls(
192
192
  const char *url,
193
193
  git_smart_subtransport_stream **stream)
194
194
  {
195
- git_net_url urldata = GIT_NET_URL_INIT;
195
+ char *host=NULL, *port=NULL, *path=NULL, *user=NULL, *pass=NULL;
196
196
  const char *stream_url = url;
197
- const char *host, *port;
198
197
  git_proto_stream *s;
199
198
  int error;
200
199
 
@@ -203,15 +202,17 @@ static int _git_uploadpack_ls(
203
202
  if (!git__prefixcmp(url, prefix_git))
204
203
  stream_url += strlen(prefix_git);
205
204
 
206
- if ((error = git_net_url_parse(&urldata, url)) < 0)
205
+ if ((error = gitno_extract_url_parts(&host, &port, &path, &user, &pass, url, GIT_DEFAULT_PORT)) < 0)
207
206
  return error;
208
207
 
209
- host = urldata.host;
210
- port = urldata.port ? urldata.port : GIT_DEFAULT_PORT;
211
-
212
208
  error = git_proto_stream_alloc(t, stream_url, cmd_uploadpack, host, port, stream);
213
209
 
214
- git_net_url_dispose(&urldata);
210
+ git__free(host);
211
+ git__free(port);
212
+ git__free(path);
213
+ git__free(user);
214
+ git__free(pass);
215
+
215
216
 
216
217
  if (error < 0) {
217
218
  git_proto_stream_free(*stream);
@@ -250,7 +251,7 @@ static int _git_receivepack_ls(
250
251
  const char *url,
251
252
  git_smart_subtransport_stream **stream)
252
253
  {
253
- git_net_url urldata = GIT_NET_URL_INIT;
254
+ char *host=NULL, *port=NULL, *path=NULL, *user=NULL, *pass=NULL;
254
255
  const char *stream_url = url;
255
256
  git_proto_stream *s;
256
257
  int error;
@@ -259,12 +260,16 @@ static int _git_receivepack_ls(
259
260
  if (!git__prefixcmp(url, prefix_git))
260
261
  stream_url += strlen(prefix_git);
261
262
 
262
- if ((error = git_net_url_parse(&urldata, url)) < 0)
263
+ if ((error = gitno_extract_url_parts(&host, &port, &path, &user, &pass, url, GIT_DEFAULT_PORT)) < 0)
263
264
  return error;
264
265
 
265
- error = git_proto_stream_alloc(t, stream_url, cmd_receivepack, urldata.host, urldata.port, stream);
266
+ error = git_proto_stream_alloc(t, stream_url, cmd_receivepack, host, port, stream);
266
267
 
267
- git_net_url_dispose(&urldata);
268
+ git__free(host);
269
+ git__free(port);
270
+ git__free(path);
271
+ git__free(user);
272
+ git__free(pass);
268
273
 
269
274
  if (error < 0) {
270
275
  git_proto_stream_free(*stream);
@@ -12,22 +12,18 @@
12
12
  #include "git2.h"
13
13
  #include "http_parser.h"
14
14
  #include "buffer.h"
15
- #include "net.h"
16
15
  #include "netops.h"
17
16
  #include "global.h"
18
17
  #include "remote.h"
19
- #include "git2/sys/cred.h"
20
18
  #include "smart.h"
21
19
  #include "auth.h"
22
20
  #include "http.h"
23
21
  #include "auth_negotiate.h"
24
- #include "auth_ntlm.h"
25
22
  #include "streams/tls.h"
26
23
  #include "streams/socket.h"
27
24
 
28
25
  git_http_auth_scheme auth_schemes[] = {
29
26
  { GIT_AUTHTYPE_NEGOTIATE, "Negotiate", GIT_CREDTYPE_DEFAULT, git_http_auth_negotiate },
30
- { GIT_AUTHTYPE_NTLM, "NTLM", GIT_CREDTYPE_USERPASS_PLAINTEXT, git_http_auth_ntlm },
31
27
  { GIT_AUTHTYPE_BASIC, "Basic", GIT_CREDTYPE_USERPASS_PLAINTEXT, git_http_auth_basic },
32
28
  };
33
29
 
@@ -75,18 +71,14 @@ typedef struct {
75
71
  } http_stream;
76
72
 
77
73
  typedef struct {
78
- git_net_url url;
74
+ gitno_connection_data url;
79
75
  git_stream *stream;
80
76
 
81
- git_http_authtype_t authtypes;
82
- git_credtype_t credtypes;
83
-
84
77
  git_cred *cred;
85
- unsigned url_cred_presented : 1,
86
- authenticated : 1;
78
+ git_cred *url_cred;
87
79
 
88
80
  git_vector auth_challenges;
89
- git_http_auth_context *auth_context;
81
+ git_vector auth_contexts;
90
82
  } http_server;
91
83
 
92
84
  typedef struct {
@@ -114,10 +106,8 @@ typedef struct {
114
106
  enum last_cb last_cb;
115
107
  int parse_error;
116
108
  int error;
117
- unsigned request_count;
118
109
  unsigned parse_finished : 1,
119
- keepalive : 1,
120
- replay_count : 4;
110
+ replay_count : 3;
121
111
  } http_subtransport;
122
112
 
123
113
  typedef struct {
@@ -130,29 +120,66 @@ typedef struct {
130
120
  size_t *bytes_read;
131
121
  } parser_context;
132
122
 
133
- static git_http_auth_scheme *scheme_for_challenge(
134
- const char *challenge,
135
- git_cred *cred)
123
+ static bool credtype_match(git_http_auth_scheme *scheme, void *data)
124
+ {
125
+ unsigned int credtype = *(unsigned int *)data;
126
+
127
+ return !!(scheme->credtypes & credtype);
128
+ }
129
+
130
+ static bool challenge_match(git_http_auth_scheme *scheme, void *data)
131
+ {
132
+ const char *scheme_name = scheme->name;
133
+ const char *challenge = (const char *)data;
134
+ size_t scheme_len;
135
+
136
+ scheme_len = strlen(scheme_name);
137
+ return (strncasecmp(challenge, scheme_name, scheme_len) == 0 &&
138
+ (challenge[scheme_len] == '\0' || challenge[scheme_len] == ' '));
139
+ }
140
+
141
+ static int auth_context_match(
142
+ git_http_auth_context **out,
143
+ http_server *server,
144
+ bool (*scheme_match)(git_http_auth_scheme *scheme, void *data),
145
+ void *data)
136
146
  {
137
147
  git_http_auth_scheme *scheme = NULL;
148
+ git_http_auth_context *context = NULL, *c;
138
149
  size_t i;
139
150
 
151
+ *out = NULL;
152
+
140
153
  for (i = 0; i < ARRAY_SIZE(auth_schemes); i++) {
141
- const char *scheme_name = auth_schemes[i].name;
142
- const git_credtype_t scheme_types = auth_schemes[i].credtypes;
143
- size_t scheme_len;
154
+ if (scheme_match(&auth_schemes[i], data)) {
155
+ scheme = &auth_schemes[i];
156
+ break;
157
+ }
158
+ }
144
159
 
145
- scheme_len = strlen(scheme_name);
160
+ if (!scheme)
161
+ return 0;
146
162
 
147
- if ((!cred || (cred->credtype & scheme_types)) &&
148
- strncasecmp(challenge, scheme_name, scheme_len) == 0 &&
149
- (challenge[scheme_len] == '\0' || challenge[scheme_len] == ' ')) {
150
- scheme = &auth_schemes[i];
163
+ /* See if authentication has already started for this scheme */
164
+ git_vector_foreach(&server->auth_contexts, i, c) {
165
+ if (c->type == scheme->type) {
166
+ context = c;
151
167
  break;
152
168
  }
153
169
  }
154
170
 
155
- return scheme;
171
+ if (!context) {
172
+ if (scheme->init_context(&context, &server->url) < 0)
173
+ return -1;
174
+ else if (!context)
175
+ return 0;
176
+ else if (git_vector_insert(&server->auth_contexts, context) < 0)
177
+ return -1;
178
+ }
179
+
180
+ *out = context;
181
+
182
+ return 0;
156
183
  }
157
184
 
158
185
  static int apply_credentials(
@@ -160,20 +187,31 @@ static int apply_credentials(
160
187
  http_server *server,
161
188
  const char *header_name)
162
189
  {
163
- git_buf token = GIT_BUF_INIT;
164
- int error = 0;
190
+ git_cred *cred = server->cred;
191
+ git_http_auth_context *context;
192
+
193
+ /* Apply the credentials given to us in the URL */
194
+ if (!cred && server->url.user && server->url.pass) {
195
+ if (!server->url_cred &&
196
+ git_cred_userpass_plaintext_new(&server->url_cred,
197
+ server->url.user, server->url.pass) < 0)
198
+ return -1;
165
199
 
166
- if (!server->auth_context)
167
- goto done;
200
+ cred = server->url_cred;
201
+ }
168
202
 
169
- if ((error = server->auth_context->next_token(&token, server->auth_context, server->cred)) < 0)
170
- goto done;
203
+ if (!cred)
204
+ return 0;
171
205
 
172
- error = git_buf_printf(buf, "%s: %s\r\n", header_name, token.ptr);
206
+ /* Get or create a context for the best scheme for this cred type */
207
+ if (auth_context_match(&context, server,
208
+ credtype_match, &cred->credtype) < 0)
209
+ return -1;
173
210
 
174
- done:
175
- git_buf_dispose(&token);
176
- return error;
211
+ if (!context)
212
+ return 0;
213
+
214
+ return context->next_token(buf, context, header_name, cred);
177
215
  }
178
216
 
179
217
  static int gen_request(
@@ -188,7 +226,7 @@ static int gen_request(
188
226
  if (t->proxy_opts.type == GIT_PROXY_SPECIFIED)
189
227
  git_buf_printf(buf, "%s %s://%s:%s%s%s HTTP/1.1\r\n",
190
228
  s->verb,
191
- t->server.url.scheme,
229
+ t->server.url.use_ssl ? "https" : "http",
192
230
  t->server.url.host,
193
231
  t->server.url.port,
194
232
  path, s->service_url);
@@ -200,10 +238,9 @@ static int gen_request(
200
238
  git_http__user_agent(buf);
201
239
  git_buf_puts(buf, "\r\n");
202
240
  git_buf_printf(buf, "Host: %s", t->server.url.host);
203
-
204
- if (!git_net_url_is_default_port(&t->server.url))
241
+ if (strcmp(t->server.url.port, gitno__default_port(&t->server.url)) != 0) {
205
242
  git_buf_printf(buf, ":%s", t->server.url.port);
206
-
243
+ }
207
244
  git_buf_puts(buf, "\r\n");
208
245
 
209
246
  if (s->chunked || content_length > 0) {
@@ -238,86 +275,29 @@ static int gen_request(
238
275
  return 0;
239
276
  }
240
277
 
241
- static int set_authentication_challenge(http_server *server)
242
- {
243
- const char *challenge;
244
-
245
- if (git_vector_length(&server->auth_challenges) > 1) {
246
- git_error_set(GIT_ERROR_NET, "received multiple authentication challenges");
247
- return -1;
248
- }
249
-
250
- challenge = git_vector_get(&server->auth_challenges, 0);
251
-
252
- if (server->auth_context->set_challenge)
253
- return server->auth_context->set_challenge(server->auth_context, challenge);
254
- else
255
- return 0;
256
- }
257
-
258
- static int set_authentication_types(http_server *server)
278
+ static int parse_authenticate_response(
279
+ http_server *server,
280
+ int *allowed_types)
259
281
  {
260
- git_http_auth_scheme *scheme;
282
+ git_http_auth_context *context;
261
283
  char *challenge;
262
284
  size_t i;
263
285
 
264
286
  git_vector_foreach(&server->auth_challenges, i, challenge) {
265
- if ((scheme = scheme_for_challenge(challenge, NULL)) != NULL) {
266
- server->authtypes |= scheme->type;
267
- server->credtypes |= scheme->credtypes;
268
- }
269
- }
270
-
271
- return 0;
272
- }
273
-
274
- static bool auth_context_complete(http_server *server)
275
- {
276
- /* If there's no is_complete function, we're always complete */
277
- if (!server->auth_context->is_complete)
278
- return true;
279
-
280
- if (server->auth_context->is_complete(server->auth_context))
281
- return true;
282
-
283
- return false;
284
- }
285
-
286
- static void free_auth_context(http_server *server)
287
- {
288
- if (!server->auth_context)
289
- return;
290
-
291
- if (server->auth_context->free)
292
- server->auth_context->free(server->auth_context);
293
-
294
- server->auth_context = NULL;
295
- }
287
+ if (auth_context_match(&context, server,
288
+ challenge_match, challenge) < 0)
289
+ return -1;
290
+ else if (!context)
291
+ continue;
296
292
 
297
- static int parse_authenticate_response(http_server *server)
298
- {
299
- /*
300
- * If we think that we've completed authentication (ie, we've either
301
- * sent a basic credential or we've sent the NTLM/Negotiate response)
302
- * but we've got an authentication request from the server then our
303
- * last authentication did not succeed. Start over.
304
- */
305
- if (server->auth_context && auth_context_complete(server)) {
306
- free_auth_context(server);
293
+ if (context->set_challenge &&
294
+ context->set_challenge(context, challenge) < 0)
295
+ return -1;
307
296
 
308
- server->authenticated = 0;
297
+ *allowed_types |= context->credtypes;
309
298
  }
310
299
 
311
- /*
312
- * If we've begun authentication, give the challenge to the context.
313
- * Otherwise, set up the types to prepare credentials.
314
- */
315
- if (git_vector_length(&server->auth_challenges) == 0)
316
- return 0;
317
- else if (server->auth_context)
318
- return set_authentication_challenge(server);
319
- else
320
- return set_authentication_types(server);
300
+ return 0;
321
301
  }
322
302
 
323
303
  static int on_header_ready(http_subtransport *t)
@@ -416,148 +396,55 @@ GIT_INLINE(void) free_cred(git_cred **cred)
416
396
  }
417
397
  }
418
398
 
419
- static int apply_url_credentials(
420
- git_cred **cred,
421
- unsigned int allowed_types,
422
- const char *username,
423
- const char *password)
424
- {
425
- if (allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)
426
- return git_cred_userpass_plaintext_new(cred, username, password);
427
-
428
- if ((allowed_types & GIT_CREDTYPE_DEFAULT) && *username == '\0' && *password == '\0')
429
- return git_cred_default_new(cred);
430
-
431
- return GIT_PASSTHROUGH;
432
- }
433
-
434
- static int init_auth(http_server *server)
435
- {
436
- git_http_auth_scheme *s, *scheme = NULL;
437
- char *c, *challenge = NULL;
438
- size_t i;
439
- int error;
440
-
441
- git_vector_foreach(&server->auth_challenges, i, c) {
442
- s = scheme_for_challenge(c, server->cred);
443
-
444
- if (s && !!(s->credtypes & server->credtypes)) {
445
- scheme = s;
446
- challenge = c;
447
- break;
448
- }
449
- }
450
-
451
- if (!scheme) {
452
- git_error_set(GIT_ERROR_NET, "no authentication mechanism could be negotiated");
453
- return -1;
454
- }
455
-
456
- if ((error = scheme->init_context(&server->auth_context, &server->url)) == GIT_PASSTHROUGH)
457
- return 0;
458
- else if (error < 0)
459
- return error;
460
-
461
- if (server->auth_context->set_challenge &&
462
- (error = server->auth_context->set_challenge(server->auth_context, challenge)) < 0)
463
- return error;
464
-
465
- return 0;
466
- }
467
-
468
399
  static int on_auth_required(
400
+ git_cred **creds,
469
401
  http_parser *parser,
470
- http_server *server,
471
402
  const char *url,
472
403
  const char *type,
473
404
  git_cred_acquire_cb callback,
474
- void *callback_payload)
405
+ void *callback_payload,
406
+ const char *username,
407
+ int allowed_types)
475
408
  {
476
409
  parser_context *ctx = (parser_context *) parser->data;
477
410
  http_subtransport *t = ctx->t;
478
- int error = 1;
479
-
480
- if (parse_authenticate_response(server) < 0) {
481
- t->parse_error = PARSE_ERROR_GENERIC;
482
- return t->parse_error;
483
- }
484
-
485
- /* If we're in the middle of challenge/response auth, continue */
486
- if (parser->status_code == 407 || parser->status_code == 401) {
487
- if (server->auth_context && !auth_context_complete(server)) {
488
- t->parse_error = PARSE_ERROR_REPLAY;
489
- return 0;
490
- }
491
- }
492
-
493
- /* Enforce a reasonable cap on the number of replays */
494
- if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
495
- git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
496
- return t->parse_error = PARSE_ERROR_GENERIC;
497
- }
411
+ int ret;
498
412
 
499
- if (!server->credtypes) {
413
+ if (!allowed_types) {
500
414
  git_error_set(GIT_ERROR_NET, "%s requested authentication but did not negotiate mechanisms", type);
501
415
  t->parse_error = PARSE_ERROR_GENERIC;
502
416
  return t->parse_error;
503
417
  }
504
418
 
505
- free_auth_context(server);
506
- free_cred(&server->cred);
419
+ if (callback) {
420
+ free_cred(creds);
421
+ ret = callback(creds, url, username, allowed_types, callback_payload);
507
422
 
508
- /* Start with URL-specified credentials, if there were any. */
509
- if (!server->url_cred_presented && server->url.username && server->url.password) {
510
- error = apply_url_credentials(&server->cred, server->credtypes, server->url.username, server->url.password);
511
- server->url_cred_presented = 1;
512
-
513
- if (error == GIT_PASSTHROUGH) {
423
+ if (ret == GIT_PASSTHROUGH) {
514
424
  /* treat GIT_PASSTHROUGH as if callback isn't set */
515
- error = 1;
516
- }
517
- }
518
-
519
- if (error > 0 && callback) {
520
- error = callback(&server->cred, url, server->url.username, server->credtypes, callback_payload);
425
+ } else if (ret < 0) {
426
+ t->error = ret;
427
+ t->parse_error = PARSE_ERROR_EXT;
428
+ return t->parse_error;
429
+ } else {
430
+ assert(*creds);
431
+
432
+ if (!((*creds)->credtype & allowed_types)) {
433
+ git_error_set(GIT_ERROR_NET, "%s credential provider returned an invalid cred type", type);
434
+ t->parse_error = PARSE_ERROR_GENERIC;
435
+ return t->parse_error;
436
+ }
521
437
 
522
- if (error == GIT_PASSTHROUGH) {
523
- /* treat GIT_PASSTHROUGH as if callback isn't set */
524
- error = 1;
438
+ /* Successfully acquired a credential. */
439
+ t->parse_error = PARSE_ERROR_REPLAY;
440
+ return 0;
525
441
  }
526
442
  }
527
443
 
528
- if (error > 0) {
529
- git_error_set(GIT_ERROR_NET, "%s authentication required but no callback set",
530
- type);
531
- t->parse_error = PARSE_ERROR_GENERIC;
532
- return t->parse_error;
533
- } else if (error < 0) {
534
- t->error = error;
535
- t->parse_error = PARSE_ERROR_EXT;
536
- return t->parse_error;
537
- }
538
-
539
- assert(server->cred);
540
-
541
- if (!(server->cred->credtype & server->credtypes)) {
542
- git_error_set(GIT_ERROR_NET, "%s credential provider returned an invalid cred type", type);
543
- t->parse_error = PARSE_ERROR_GENERIC;
544
- return t->parse_error;
545
- }
546
-
547
- /* Successfully acquired a credential. Start an auth context. */
548
- if (init_auth(server) < 0) {
549
- t->parse_error = PARSE_ERROR_GENERIC;
550
- return t->parse_error;
551
- }
552
-
553
- t->parse_error = PARSE_ERROR_REPLAY;
554
- return 0;
555
- }
556
-
557
- static void on_auth_success(http_server *server)
558
- {
559
- server->url_cred_presented = 0;
560
- server->authenticated = 1;
444
+ git_error_set(GIT_ERROR_NET, "%s authentication required but no callback set",
445
+ type);
446
+ t->parse_error = PARSE_ERROR_GENERIC;
447
+ return t->parse_error;
561
448
  }
562
449
 
563
450
  static int on_headers_complete(http_parser *parser)
@@ -566,35 +453,50 @@ static int on_headers_complete(http_parser *parser)
566
453
  http_subtransport *t = ctx->t;
567
454
  http_stream *s = ctx->s;
568
455
  git_buf buf = GIT_BUF_INIT;
456
+ int proxy_auth_types = 0, server_auth_types = 0;
457
+
458
+ /* Enforce a reasonable cap on the number of replays */
459
+ if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
460
+ git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
461
+ return t->parse_error = PARSE_ERROR_GENERIC;
462
+ }
569
463
 
570
464
  /* Both parse_header_name and parse_header_value are populated
571
465
  * and ready for consumption. */
572
- if (t->last_cb == VALUE && on_header_ready(t) < 0)
466
+ if (VALUE == t->last_cb)
467
+ if (on_header_ready(t) < 0)
468
+ return t->parse_error = PARSE_ERROR_GENERIC;
469
+
470
+ /*
471
+ * Capture authentication headers for the proxy or final endpoint,
472
+ * these may be 407/401 (authentication is not complete) or a 200
473
+ * (informing us that auth has completed).
474
+ */
475
+ if (parse_authenticate_response(&t->proxy, &proxy_auth_types) < 0 ||
476
+ parse_authenticate_response(&t->server, &server_auth_types) < 0)
573
477
  return t->parse_error = PARSE_ERROR_GENERIC;
574
478
 
575
479
  /* Check for a proxy authentication failure. */
576
480
  if (parser->status_code == 407 && get_verb == s->verb)
577
- return on_auth_required(
481
+ return on_auth_required(&t->proxy.cred,
578
482
  parser,
579
- &t->proxy,
580
483
  t->proxy_opts.url,
581
484
  SERVER_TYPE_PROXY,
582
485
  t->proxy_opts.credentials,
583
- t->proxy_opts.payload);
584
- else
585
- on_auth_success(&t->proxy);
486
+ t->proxy_opts.payload,
487
+ t->proxy.url.user,
488
+ proxy_auth_types);
586
489
 
587
490
  /* Check for an authentication failure. */
588
491
  if (parser->status_code == 401 && get_verb == s->verb)
589
- return on_auth_required(
492
+ return on_auth_required(&t->server.cred,
590
493
  parser,
591
- &t->server,
592
494
  t->owner->url,
593
495
  SERVER_TYPE_REMOTE,
594
496
  t->owner->cred_acquire_cb,
595
- t->owner->cred_acquire_payload);
596
- else
597
- on_auth_success(&t->server);
497
+ t->owner->cred_acquire_payload,
498
+ t->server.url.user,
499
+ server_auth_types);
598
500
 
599
501
  /* Check for a redirect.
600
502
  * Right now we only permit a redirect to the same hostname. */
@@ -605,7 +507,7 @@ static int on_headers_complete(http_parser *parser)
605
507
  parser->status_code == 308) &&
606
508
  t->location) {
607
509
 
608
- if (gitno_connection_data_handle_redirect(&t->server.url, t->location, s->service_url) < 0)
510
+ if (gitno_connection_data_from_url(&t->server.url, t->location, s->service_url) < 0)
609
511
  return t->parse_error = PARSE_ERROR_GENERIC;
610
512
 
611
513
  /* Set the redirect URL on the stream. This is a transfer of
@@ -667,7 +569,6 @@ static int on_message_complete(http_parser *parser)
667
569
  http_subtransport *t = ctx->t;
668
570
 
669
571
  t->parse_finished = 1;
670
- t->keepalive = http_should_keep_alive(parser);
671
572
 
672
573
  return 0;
673
574
  }
@@ -677,6 +578,13 @@ static int on_body_fill_buffer(http_parser *parser, const char *str, size_t len)
677
578
  parser_context *ctx = (parser_context *) parser->data;
678
579
  http_subtransport *t = ctx->t;
679
580
 
581
+ /* If our goal is to replay the request (either an auth failure or
582
+ * a redirect) then don't bother buffering since we're ignoring the
583
+ * content anyway.
584
+ */
585
+ if (t->parse_error == PARSE_ERROR_REPLAY)
586
+ return 0;
587
+
680
588
  /* If there's no buffer set, we're explicitly ignoring the body. */
681
589
  if (ctx->buffer) {
682
590
  if (ctx->buf_size < len) {
@@ -705,7 +613,6 @@ static void clear_parser_state(http_subtransport *t)
705
613
  t->last_cb = NONE;
706
614
  t->parse_error = 0;
707
615
  t->parse_finished = 0;
708
- t->keepalive = 0;
709
616
 
710
617
  git_buf_dispose(&t->parse_header_name);
711
618
  git_buf_init(&t->parse_header_name, 0);
@@ -766,10 +673,10 @@ static int load_proxy_config(http_subtransport *t)
766
673
  git__free(t->proxy_url);
767
674
  t->proxy_url = NULL;
768
675
 
769
- git_proxy_options_init(&t->proxy_opts, GIT_PROXY_OPTIONS_VERSION);
676
+ git_proxy_init_options(&t->proxy_opts, GIT_PROXY_OPTIONS_VERSION);
770
677
 
771
678
  if ((error = git_remote__get_http_proxy(t->owner->owner,
772
- !strcmp(t->server.url.scheme, "https"), &t->proxy_url)) < 0)
679
+ !!t->server.url.use_ssl, &t->proxy_url)) < 0)
773
680
  return error;
774
681
 
775
682
  if (!t->proxy_url)
@@ -791,14 +698,20 @@ static int load_proxy_config(http_subtransport *t)
791
698
  return -1;
792
699
  }
793
700
 
794
- git_net_url_dispose(&t->proxy.url);
701
+ if ((error = gitno_connection_data_from_url(&t->proxy.url, t->proxy_opts.url, NULL)) < 0)
702
+ return error;
795
703
 
796
- return git_net_url_parse(&t->proxy.url, t->proxy_opts.url);
704
+ if (t->proxy.url.use_ssl) {
705
+ git_error_set(GIT_ERROR_NET, "SSL connections to proxy are not supported");
706
+ return -1;
707
+ }
708
+
709
+ return error;
797
710
  }
798
711
 
799
712
  static int check_certificate(
800
713
  git_stream *stream,
801
- git_net_url *url,
714
+ gitno_connection_data *url,
802
715
  int is_valid,
803
716
  git_transport_certificate_check_cb cert_cb,
804
717
  void *cert_cb_payload)
@@ -827,7 +740,7 @@ static int check_certificate(
827
740
 
828
741
  static int stream_connect(
829
742
  git_stream *stream,
830
- git_net_url *url,
743
+ gitno_connection_data *url,
831
744
  git_transport_certificate_check_cb cert_cb,
832
745
  void *cb_payload)
833
746
  {
@@ -869,10 +782,18 @@ static int proxy_headers_complete(http_parser *parser)
869
782
  {
870
783
  parser_context *ctx = (parser_context *) parser->data;
871
784
  http_subtransport *t = ctx->t;
785
+ int proxy_auth_types = 0;
786
+
787
+ /* Enforce a reasonable cap on the number of replays */
788
+ if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
789
+ git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
790
+ return t->parse_error = PARSE_ERROR_GENERIC;
791
+ }
872
792
 
873
793
  /* Both parse_header_name and parse_header_value are populated
874
794
  * and ready for consumption. */
875
- if (t->last_cb == VALUE && on_header_ready(t) < 0)
795
+ if (VALUE == t->last_cb)
796
+ if (on_header_ready(t) < 0)
876
797
  return t->parse_error = PARSE_ERROR_GENERIC;
877
798
 
878
799
  /*
@@ -880,32 +801,19 @@ static int proxy_headers_complete(http_parser *parser)
880
801
  * these may be 407/401 (authentication is not complete) or a 200
881
802
  * (informing us that auth has completed).
882
803
  */
883
- if (parse_authenticate_response(&t->proxy) < 0)
804
+ if (parse_authenticate_response(&t->proxy, &proxy_auth_types) < 0)
884
805
  return t->parse_error = PARSE_ERROR_GENERIC;
885
806
 
886
- /* If we're in the middle of challenge/response auth, continue */
887
- if (parser->status_code == 407) {
888
- if (t->proxy.auth_context && !auth_context_complete(&t->proxy)) {
889
- t->parse_error = PARSE_ERROR_REPLAY;
890
- return 0;
891
- }
892
- }
893
-
894
- /* Enforce a reasonable cap on the number of replays */
895
- if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
896
- git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
897
- return t->parse_error = PARSE_ERROR_GENERIC;
898
- }
899
-
900
807
  /* Check for a proxy authentication failure. */
901
808
  if (parser->status_code == 407)
902
- return on_auth_required(
809
+ return on_auth_required(&t->proxy.cred,
903
810
  parser,
904
- &t->proxy,
905
811
  t->proxy_opts.url,
906
812
  SERVER_TYPE_PROXY,
907
813
  t->proxy_opts.credentials,
908
- t->proxy_opts.payload);
814
+ t->proxy_opts.payload,
815
+ t->proxy.url.user,
816
+ proxy_auth_types);
909
817
 
910
818
  if (parser->status_code != 200) {
911
819
  git_error_set(GIT_ERROR_NET, "unexpected status code from proxy: %d",
@@ -926,7 +834,6 @@ static int proxy_connect(
926
834
  static http_parser_settings proxy_parser_settings = {0};
927
835
  size_t bytes_read = 0, bytes_parsed;
928
836
  parser_context ctx;
929
- bool auth_replay;
930
837
  int error;
931
838
 
932
839
  /* Use the parser settings only to parser headers. */
@@ -938,8 +845,6 @@ static int proxy_connect(
938
845
  replay:
939
846
  clear_parser_state(t);
940
847
 
941
- auth_replay = false;
942
-
943
848
  gitno_buffer_setup_fromstream(proxy_stream,
944
849
  &t->parse_buffer,
945
850
  t->parse_buffer_data,
@@ -957,17 +862,8 @@ replay:
957
862
  while (!bytes_read && !t->parse_finished) {
958
863
  t->parse_buffer.offset = 0;
959
864
 
960
- if ((error = gitno_recv(&t->parse_buffer)) < 0) {
961
- goto done;
962
- } else if (error == 0 && t->request_count > 0) {
963
- /* Server closed a keep-alive socket; reconnect. */
964
- auth_replay = true;
965
- goto done;
966
- } else if (error == 0) {
967
- git_error_set(GIT_ERROR_NET, "unexpected disconnection from server");
968
- error = -1;
865
+ if ((error = gitno_recv(&t->parse_buffer)) < 0)
969
866
  goto done;
970
- }
971
867
 
972
868
  /*
973
869
  * This call to http_parser_execute will invoke the on_*
@@ -996,9 +892,10 @@ replay:
996
892
  }
997
893
 
998
894
  /* Replay the request with authentication headers. */
999
- if (PARSE_ERROR_REPLAY == t->parse_error) {
1000
- auth_replay = true;
1001
- } else if (t->parse_error < 0) {
895
+ if (PARSE_ERROR_REPLAY == t->parse_error)
896
+ goto replay;
897
+
898
+ if (t->parse_error < 0) {
1002
899
  error = t->parse_error == PARSE_ERROR_EXT ? PARSE_ERROR_EXT : -1;
1003
900
  goto done;
1004
901
  }
@@ -1012,15 +909,6 @@ replay:
1012
909
  }
1013
910
  }
1014
911
 
1015
- t->request_count++;
1016
-
1017
- if (auth_replay) {
1018
- if (t->keepalive && t->parse_finished)
1019
- goto replay;
1020
-
1021
- return PARSE_ERROR_REPLAY;
1022
- }
1023
-
1024
912
  if ((error = git_tls_stream_wrap(out, proxy_stream, t->server.url.host)) == 0)
1025
913
  error = stream_connect(*out, &t->server.url,
1026
914
  t->owner->certificate_check_cb,
@@ -1032,45 +920,22 @@ replay:
1032
920
  */
1033
921
  t->proxy_opts.type = GIT_PROXY_NONE;
1034
922
  t->replay_count = 0;
1035
- t->request_count = 0;
1036
923
 
1037
924
  done:
1038
925
  return error;
1039
926
  }
1040
927
 
1041
- static void reset_auth_connection(http_server *server)
1042
- {
1043
- /*
1044
- * If we've authenticated and we're doing "normal"
1045
- * authentication with a request affinity (Basic, Digest)
1046
- * then we want to _keep_ our context, since authentication
1047
- * survives even through non-keep-alive connections. If
1048
- * we've authenticated and we're doing connection-based
1049
- * authentication (NTLM, Negotiate) - indicated by the presence
1050
- * of an `is_complete` callback - then we need to restart
1051
- * authentication on a new connection.
1052
- */
1053
-
1054
- if (server->authenticated &&
1055
- server->auth_context &&
1056
- server->auth_context->connection_affinity) {
1057
- free_auth_context(server);
1058
-
1059
- server->url_cred_presented = 0;
1060
- server->authenticated = 0;
1061
- }
1062
- }
1063
-
1064
928
  static int http_connect(http_subtransport *t)
1065
929
  {
1066
- git_net_url *url;
930
+ gitno_connection_data *url;
1067
931
  git_stream *proxy_stream = NULL, *stream = NULL;
1068
932
  git_transport_certificate_check_cb cert_cb;
1069
933
  void *cb_payload;
1070
934
  int error;
1071
935
 
1072
- auth_replay:
1073
- if (t->connected && t->keepalive && t->parse_finished)
936
+ if (t->connected &&
937
+ http_should_keep_alive(&t->parser) &&
938
+ t->parse_finished)
1074
939
  return 0;
1075
940
 
1076
941
  if ((error = load_proxy_config(t)) < 0)
@@ -1088,12 +953,7 @@ auth_replay:
1088
953
  t->proxy.stream = NULL;
1089
954
  }
1090
955
 
1091
- reset_auth_connection(&t->server);
1092
- reset_auth_connection(&t->proxy);
1093
-
1094
956
  t->connected = 0;
1095
- t->keepalive = 0;
1096
- t->request_count = 0;
1097
957
 
1098
958
  if (t->proxy_opts.type == GIT_PROXY_SPECIFIED) {
1099
959
  url = &t->proxy.url;
@@ -1105,7 +965,7 @@ auth_replay:
1105
965
  cb_payload = t->owner->message_cb_payload;
1106
966
  }
1107
967
 
1108
- if (strcmp(url->scheme, "https") == 0)
968
+ if (url->use_ssl)
1109
969
  error = git_tls_stream_new(&stream, url->host, url->port);
1110
970
  else
1111
971
  error = git_socket_stream_new(&stream, url->host, url->port);
@@ -1122,24 +982,18 @@ auth_replay:
1122
982
  * an HTTPS connection, then we need to build a CONNECT tunnel.
1123
983
  */
1124
984
  if (t->proxy_opts.type == GIT_PROXY_SPECIFIED &&
1125
- strcmp(t->server.url.scheme, "https") == 0) {
985
+ t->server.url.use_ssl) {
1126
986
  proxy_stream = stream;
1127
987
  stream = NULL;
1128
988
 
1129
- error = proxy_connect(&stream, proxy_stream, t);
1130
-
1131
- if (error == PARSE_ERROR_REPLAY) {
1132
- git_stream_close(proxy_stream);
1133
- git_stream_free(proxy_stream);
1134
- goto auth_replay;
1135
- } else if (error < 0) {
989
+ if ((error = proxy_connect(&stream, proxy_stream, t)) < 0)
1136
990
  goto on_error;
1137
- }
1138
991
  }
1139
992
 
1140
993
  t->proxy.stream = proxy_stream;
1141
994
  t->server.stream = stream;
1142
995
  t->connected = 1;
996
+ t->replay_count = 0;
1143
997
  return 0;
1144
998
 
1145
999
  on_error:
@@ -1166,23 +1020,27 @@ static int http_stream_read(
1166
1020
  http_subtransport *t = OWNING_SUBTRANSPORT(s);
1167
1021
  parser_context ctx;
1168
1022
  size_t bytes_parsed;
1169
- git_buf request = GIT_BUF_INIT;
1170
- bool auth_replay;
1171
- int error = 0;
1172
1023
 
1173
1024
  replay:
1174
1025
  *bytes_read = 0;
1175
- auth_replay = false;
1176
1026
 
1177
1027
  assert(t->connected);
1178
1028
 
1179
1029
  if (!s->sent_request) {
1180
- git_buf_clear(&request);
1030
+ git_buf request = GIT_BUF_INIT;
1031
+
1181
1032
  clear_parser_state(t);
1182
1033
 
1183
- if ((error = gen_request(&request, s, 0)) < 0 ||
1184
- (error = git_stream__write_full(t->server.stream, request.ptr, request.size, 0)) < 0)
1185
- goto done;
1034
+ if (gen_request(&request, s, 0) < 0)
1035
+ return -1;
1036
+
1037
+ if (git_stream__write_full(t->server.stream, request.ptr,
1038
+ request.size, 0) < 0) {
1039
+ git_buf_dispose(&request);
1040
+ return -1;
1041
+ }
1042
+
1043
+ git_buf_dispose(&request);
1186
1044
 
1187
1045
  s->sent_request = 1;
1188
1046
  }
@@ -1192,17 +1050,17 @@ replay:
1192
1050
  assert(s->verb == post_verb);
1193
1051
 
1194
1052
  /* Flush, if necessary */
1195
- if (s->chunk_buffer_len > 0) {
1196
- if ((error = write_chunk(t->server.stream, s->chunk_buffer, s->chunk_buffer_len)) < 0)
1197
- goto done;
1053
+ if (s->chunk_buffer_len > 0 &&
1054
+ write_chunk(t->server.stream,
1055
+ s->chunk_buffer, s->chunk_buffer_len) < 0)
1056
+ return -1;
1198
1057
 
1199
- s->chunk_buffer_len = 0;
1200
- }
1058
+ s->chunk_buffer_len = 0;
1201
1059
 
1202
1060
  /* Write the final chunk. */
1203
- if ((error = git_stream__write_full(t->server.stream,
1204
- "0\r\n\r\n", 5, 0)) < 0)
1205
- goto done;
1061
+ if (git_stream__write_full(t->server.stream,
1062
+ "0\r\n\r\n", 5, 0) < 0)
1063
+ return -1;
1206
1064
  }
1207
1065
 
1208
1066
  s->received_response = 1;
@@ -1210,6 +1068,7 @@ replay:
1210
1068
 
1211
1069
  while (!*bytes_read && !t->parse_finished) {
1212
1070
  size_t data_offset;
1071
+ int error;
1213
1072
 
1214
1073
  /*
1215
1074
  * Make the parse_buffer think it's as full of data as
@@ -1219,37 +1078,26 @@ replay:
1219
1078
  * data_offset is the actual data offset from which we
1220
1079
  * should tell the parser to start reading.
1221
1080
  */
1222
- if (buf_size >= t->parse_buffer.len)
1081
+ if (buf_size >= t->parse_buffer.len) {
1223
1082
  t->parse_buffer.offset = 0;
1224
- else
1083
+ } else {
1225
1084
  t->parse_buffer.offset = t->parse_buffer.len - buf_size;
1085
+ }
1226
1086
 
1227
1087
  data_offset = t->parse_buffer.offset;
1228
1088
 
1229
- if ((error = gitno_recv(&t->parse_buffer)) < 0) {
1230
- goto done;
1231
- } else if (error == 0 && t->request_count > 0) {
1232
- /* Server closed a keep-alive socket; reconnect. */
1233
- auth_replay = true;
1234
- goto done;
1235
- } else if (error == 0) {
1236
- git_error_set(GIT_ERROR_NET, "unexpected disconnection from server");
1237
- error = -1;
1238
- goto done;
1239
- }
1089
+ if (gitno_recv(&t->parse_buffer) < 0)
1090
+ return -1;
1240
1091
 
1241
- /*
1242
- * This call to http_parser_execute will result in invocations
1243
- * of the on_* family of callbacks, including on_body_fill_buffer
1244
- * which will write into the target buffer. Set up the buffer
1245
- * for it to write into _unless_ we got an auth failure; in
1246
- * that case we only care about the headers and don't need to
1247
- * bother copying the body.
1248
- */
1092
+ /* This call to http_parser_execute will result in invocations of the
1093
+ * on_* family of callbacks. The most interesting of these is
1094
+ * on_body_fill_buffer, which is called when data is ready to be copied
1095
+ * into the target buffer. We need to marshal the buffer, buf_size, and
1096
+ * bytes_read parameters to this callback. */
1249
1097
  ctx.t = t;
1250
1098
  ctx.s = s;
1251
- ctx.buffer = auth_replay ? NULL : buffer;
1252
- ctx.buf_size = auth_replay ? 0 : buf_size;
1099
+ ctx.buffer = buffer;
1100
+ ctx.buf_size = buf_size;
1253
1101
  ctx.bytes_read = bytes_read;
1254
1102
 
1255
1103
  /* Set the context, call the parser, then unset the context. */
@@ -1262,40 +1110,33 @@ replay:
1262
1110
 
1263
1111
  t->parser.data = NULL;
1264
1112
 
1265
- /* On a 401, read the rest of the response then retry. */
1266
- if (t->parse_error == PARSE_ERROR_REPLAY) {
1267
- auth_replay = true;
1268
- } else if (t->parse_error == PARSE_ERROR_EXT) {
1269
- error = t->error;
1270
- goto done;
1271
- } else if (t->parse_error < 0) {
1272
- error = -1;
1273
- goto done;
1113
+ /* If there was a handled authentication failure, then parse_error
1114
+ * will have signaled us that we should replay the request. */
1115
+ if (PARSE_ERROR_REPLAY == t->parse_error) {
1116
+ s->sent_request = 0;
1117
+
1118
+ if ((error = http_connect(t)) < 0)
1119
+ return error;
1120
+
1121
+ goto replay;
1274
1122
  }
1275
1123
 
1124
+ if (t->parse_error == PARSE_ERROR_EXT) {
1125
+ return t->error;
1126
+ }
1127
+
1128
+ if (t->parse_error < 0)
1129
+ return -1;
1130
+
1276
1131
  if (bytes_parsed != t->parse_buffer.offset - data_offset) {
1277
1132
  git_error_set(GIT_ERROR_NET,
1278
1133
  "HTTP parser error: %s",
1279
1134
  http_errno_description((enum http_errno)t->parser.http_errno));
1280
- error = -1;
1281
- goto done;
1135
+ return -1;
1282
1136
  }
1283
1137
  }
1284
1138
 
1285
- t->request_count++;
1286
-
1287
- if (auth_replay) {
1288
- s->sent_request = 0;
1289
-
1290
- if ((error = http_connect(t)) < 0)
1291
- return error;
1292
-
1293
- goto replay;
1294
- }
1295
-
1296
- done:
1297
- git_buf_dispose(&request);
1298
- return error;
1139
+ return 0;
1299
1140
  }
1300
1141
 
1301
1142
  static int http_stream_write_chunked(
@@ -1303,7 +1144,7 @@ static int http_stream_write_chunked(
1303
1144
  const char *buffer,
1304
1145
  size_t len)
1305
1146
  {
1306
- http_stream *s = GIT_CONTAINER_OF(stream, http_stream, parent);
1147
+ http_stream *s = (http_stream *)stream;
1307
1148
  http_subtransport *t = OWNING_SUBTRANSPORT(s);
1308
1149
 
1309
1150
  assert(t->connected);
@@ -1346,10 +1187,8 @@ static int http_stream_write_chunked(
1346
1187
  /* Append as much to the buffer as we can */
1347
1188
  int count = min(CHUNK_SIZE - s->chunk_buffer_len, len);
1348
1189
 
1349
- if (!s->chunk_buffer) {
1190
+ if (!s->chunk_buffer)
1350
1191
  s->chunk_buffer = git__malloc(CHUNK_SIZE);
1351
- GIT_ERROR_CHECK_ALLOC(s->chunk_buffer);
1352
- }
1353
1192
 
1354
1193
  memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
1355
1194
  s->chunk_buffer_len += count;
@@ -1379,7 +1218,7 @@ static int http_stream_write_single(
1379
1218
  const char *buffer,
1380
1219
  size_t len)
1381
1220
  {
1382
- http_stream *s = GIT_CONTAINER_OF(stream, http_stream, parent);
1221
+ http_stream *s = (http_stream *)stream;
1383
1222
  http_subtransport *t = OWNING_SUBTRANSPORT(s);
1384
1223
  git_buf request = GIT_BUF_INIT;
1385
1224
 
@@ -1413,7 +1252,7 @@ on_error:
1413
1252
 
1414
1253
  static void http_stream_free(git_smart_subtransport_stream *stream)
1415
1254
  {
1416
- http_stream *s = GIT_CONTAINER_OF(stream, http_stream, parent);
1255
+ http_stream *s = (http_stream *)stream;
1417
1256
 
1418
1257
  if (s->chunk_buffer)
1419
1258
  git__free(s->chunk_buffer);
@@ -1526,7 +1365,7 @@ static int http_action(
1526
1365
  const char *url,
1527
1366
  git_smart_service_t action)
1528
1367
  {
1529
- http_subtransport *t = GIT_CONTAINER_OF(subtransport, http_subtransport, parent);
1368
+ http_subtransport *t = (http_subtransport *)subtransport;
1530
1369
  int ret;
1531
1370
 
1532
1371
  assert(stream);
@@ -1539,7 +1378,7 @@ static int http_action(
1539
1378
  * that would be insecure in plaintext (eg, HTTP Basic).
1540
1379
  */
1541
1380
  if ((!t->server.url.host || !t->server.url.port || !t->server.url.path) &&
1542
- (ret = git_net_url_parse(&t->server.url, url)) < 0)
1381
+ (ret = gitno_connection_data_from_url(&t->server.url, url, NULL)) < 0)
1543
1382
  return ret;
1544
1383
 
1545
1384
  assert(t->server.url.host && t->server.url.port && t->server.url.path);
@@ -1565,9 +1404,22 @@ static int http_action(
1565
1404
  return -1;
1566
1405
  }
1567
1406
 
1407
+ static void free_auth_contexts(git_vector *contexts)
1408
+ {
1409
+ git_http_auth_context *context;
1410
+ size_t i;
1411
+
1412
+ git_vector_foreach(contexts, i, context) {
1413
+ if (context->free)
1414
+ context->free(context);
1415
+ }
1416
+
1417
+ git_vector_clear(contexts);
1418
+ }
1419
+
1568
1420
  static int http_close(git_smart_subtransport *subtransport)
1569
1421
  {
1570
- http_subtransport *t = GIT_CONTAINER_OF(subtransport, http_subtransport, parent);
1422
+ http_subtransport *t = (http_subtransport *) subtransport;
1571
1423
 
1572
1424
  clear_parser_state(t);
1573
1425
 
@@ -1586,16 +1438,18 @@ static int http_close(git_smart_subtransport *subtransport)
1586
1438
  }
1587
1439
 
1588
1440
  free_cred(&t->server.cred);
1441
+ free_cred(&t->server.url_cred);
1589
1442
  free_cred(&t->proxy.cred);
1443
+ free_cred(&t->proxy.url_cred);
1590
1444
 
1591
- free_auth_context(&t->server);
1592
- free_auth_context(&t->proxy);
1445
+ free_auth_contexts(&t->server.auth_contexts);
1446
+ free_auth_contexts(&t->proxy.auth_contexts);
1593
1447
 
1594
- t->server.url_cred_presented = false;
1595
- t->proxy.url_cred_presented = false;
1448
+ gitno_connection_data_free_ptrs(&t->server.url);
1449
+ memset(&t->server.url, 0x0, sizeof(gitno_connection_data));
1596
1450
 
1597
- git_net_url_dispose(&t->server.url);
1598
- git_net_url_dispose(&t->proxy.url);
1451
+ gitno_connection_data_free_ptrs(&t->proxy.url);
1452
+ memset(&t->proxy.url, 0x0, sizeof(gitno_connection_data));
1599
1453
 
1600
1454
  git__free(t->proxy_url);
1601
1455
  t->proxy_url = NULL;
@@ -1605,9 +1459,12 @@ static int http_close(git_smart_subtransport *subtransport)
1605
1459
 
1606
1460
  static void http_free(git_smart_subtransport *subtransport)
1607
1461
  {
1608
- http_subtransport *t = GIT_CONTAINER_OF(subtransport, http_subtransport, parent);
1462
+ http_subtransport *t = (http_subtransport *) subtransport;
1609
1463
 
1610
1464
  http_close(subtransport);
1465
+
1466
+ git_vector_free(&t->server.auth_contexts);
1467
+ git_vector_free(&t->proxy.auth_contexts);
1611
1468
  git__free(t);
1612
1469
  }
1613
1470