Commit Graph

14044 Commits

Author SHA1 Message Date
Edward Thomson
4fd32be01c url: ensure minimum components for formatting v1.2.0 2021-09-01 23:06:19 -04:00
Edward Thomson
fd50810aeb url: ensure minimum components for formatting 2021-09-01 22:49:14 -04:00
Edward Thomson
002b2ffe69 Merge pull request #6026 from libgit2/ethomson/proxy
Update proxy configuration
2021-09-01 21:57:16 -04:00
Edward Thomson
3c0f14cc95 remote: refactor proxy detection
Update the proxy detection for a remote.

1. Honor `http.<url>.proxy` syntax for a remote's direct URL and
   parent URLs.
2. Honor an empty configuration URL to override a proxy configuration.

Add tests to ensure that configuration specificity is honored.
2021-09-01 21:20:25 -04:00
Edward Thomson
f89dc917d7 url: introduce git_net_url_dup 2021-09-01 20:40:27 -04:00
Edward Thomson
9e98e443ca url: introduce git_net_url_matches_pattern_list
Provide a utility method on a url to determine if it matches any pattern
in a comma-separated list, similar to what one would find in `NO_PROXY`
environment variables.
2021-09-01 20:40:19 -04:00
Edward Thomson
e5ba0a3c37 url: introduce git_net_url_matches_pattern
Provide a method to determine if a given URL matches a host:port pattern
like the ones found in `NO_PROXY` environment variables.
2021-09-01 20:40:05 -04:00
Edward Thomson
3680f0bf52 tests: create the network::url test hierarcy 2021-09-01 20:39:56 -04:00
Edward Thomson
1196de4f26 util: introduce git__strlcmp
Introduce a utility function that compares a NUL terminated string to a
possibly not-NUL terminated string with length.  This is similar to
`strncmp` but with an added check to ensure that the lengths match (not
just the `size` portion of the two strings).
2021-09-01 20:39:51 -04:00
Mathieu Parent
e5a3277452 Add NO_PROXY env support
Item 2 of 3 from #4164

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2021-09-01 20:39:25 -04:00
Edward Thomson
d56b4079e0 Merge pull request #6024 from lhchavez/fix-possible-null-pointer-dereference
Fix a possible null pointer dereference
2021-08-31 09:21:22 -04:00
lhchavez
1e49f12793 Fix a possible null pointer dereference
This change fixes a possible null pointer dereference if anything inside
`git_commit_graph_writer_add_index_file` fails before the packfile being
valid.

https://scan6.coverity.com/reports.htm#v52218/p10377/fileInstanceId=122935896&defectInstanceId=32525576&mergedDefectId=1461634
2021-08-31 05:23:20 -07:00
Edward Thomson
c811fc361b v1.2: update version information 2021-08-31 00:19:01 -04:00
Edward Thomson
0e585d368e v1.2: changelog 2021-08-31 00:19:01 -04:00
Edward Thomson
3addb796d3 Merge pull request #5943 from kcsaul/fix/5851
Fix worktree iteration when repository has no common directory
2021-08-30 23:10:24 -04:00
Edward Thomson
4e8840fd19 Merge pull request #6022 from lollipopman/connect-proxy-host-header
Set Host Header to match CONNECT authority target
2021-08-30 18:20:35 -04:00
Edward Thomson
98be5a1142 Merge branch 'cgraph-write' into main 2021-08-30 17:55:47 -04:00
Edward Thomson
34fa631142 commit graph: formatting fixes 2021-08-30 17:55:13 -04:00
Jesse Hathaway
fc5d0e80f9 Set Host Header to match CONNECT authority target
Prior to this change, for CONNECT requests, the Host header was set to
the host and port of the target http proxy. However, per the rfc7230 for
HTTP/1.1 this is incorrect as the Host header should match the target of
the CONNECT request, as detailed in section 5.3.3 & 5.4.

  5.3.3.  authority-form

   The authority-form of request-target is only used for CONNECT
   requests (Section 4.3.6 of [RFC7231]).

     authority-form = authority

   When making a CONNECT request to establish a tunnel through one or
   more proxies, a client MUST send only the target URI's authority
   component (excluding any userinfo and its "@" delimiter) as the
   request-target.  For example,

     CONNECT www.example.com:80 HTTP/1.1

  5.4.  Host

   <snip>

   A client MUST send a Host header field in all HTTP/1.1 request
   messages.  If the target URI includes an authority component, then a
   client MUST send a field-value for Host that is identical to that
   authority component, excluding any userinfo subcomponent and its "@"
   delimiter (Section 2.7.1).  If the authority component is missing or
   undefined for the target URI, then a client MUST send a Host header
   field with an empty field-value.

This issue was noticed when proxying requests through HAProxy 2.2 which
rejects these invalid http requests.
2021-08-30 21:38:21 +00:00
Edward Thomson
db72980323 Merge pull request #6018 from libgit2/ethomson/fixups
Fixes from code analysis
2021-08-30 09:24:48 -04:00
Edward Thomson
ed0ea96ed9 date: promote before multiply 2021-08-30 09:02:49 -04:00
Edward Thomson
f93beebcba filter: don't overwrite error value 2021-08-30 09:02:49 -04:00
Edward Thomson
036be15070 hashsig: close fd on error 2021-08-30 09:02:49 -04:00
Edward Thomson
9191ef70e2 error: don't check string after assert 2021-08-30 09:02:49 -04:00
Edward Thomson
50b3c2d56d pack: don't assert in the lock 2021-08-30 09:02:49 -04:00
Edward Thomson
e7eb6c6bb0 midx: return an error when detected 2021-08-30 09:02:49 -04:00
Edward Thomson
5eb2b0b31b httpclient: actually return GIT_EAUTH 2021-08-30 08:27:27 -04:00
Edward Thomson
969a056cc5 Merge pull request #6017 from libgit2/ethomson/buf_is_readonly
buf: deprecate public git_buf writing functions
2021-08-29 22:54:01 -04:00
Edward Thomson
b16a36e111 Merge pull request #6011 from libgit2/ethomson/filter_apply
filter: filter drivers stop taking git_buf as user input
2021-08-29 22:53:49 -04:00
Edward Thomson
258115db3e Merge pull request #6016 from libgit2/ethomson/commit_create_cb
Introduce `create_commit_cb`, deprecate `signing_cb`
2021-08-29 22:53:38 -04:00
Edward Thomson
16a2e6676f Merge pull request #6012 from libgit2/ethomson/custom_url
remote: introduce remote_ready_cb, deprecate resolve_url callback
2021-08-29 22:53:28 -04:00
Edward Thomson
9f84003c22 Merge pull request #6009 from libgit2/ethomson/custom_cert_locations
opts: test GIT_OPT_SET_SSL_CERT_LOCATIONS
2021-08-29 22:34:19 -04:00
Zachary Michaels
cdb9f3903e mbedTLS: Fix setting certificate directory
fixes #6003
2021-08-29 21:52:30 -04:00
Edward Thomson
0e04726866 opts: test GIT_OPT_SET_SSL_CERT_LOCATIONS
Include a self-signed certificate for test.libgit2.org:1443 that we can
use to verify that GIT_OPT_SET_SSL_CERT_LOCATIONS works.
2021-08-29 21:52:30 -04:00
lhchavez
7d9ebdc840 Merge remote-tracking branch 'origin/main' into cgraph-write 2021-08-29 18:50:49 -07:00
Edward Thomson
2998a84ab6 Merge pull request #5841 from J0Nes90/features/checkout-dry-run
Checkout dry-run
2021-08-29 21:49:33 -04:00
Edward Thomson
aebdee8e3d Update include/git2/checkout.h 2021-08-29 21:49:26 -04:00
Edward Thomson
147b659f3b Merge pull request #5405 from lhchavez/multi-pack-index-odb-write
midx: Introduce git_odb_write_multi_pack_index()
2021-08-29 21:40:26 -04:00
Edward Thomson
18293385d0 Merge pull request #5395 from josharian/http-use-eauth
Use error code GIT_EAUTH for authentication failures
2021-08-29 21:40:16 -04:00
Edward Thomson
c3512fe6d2 Merge branch 'main' into multi-pack-index-odb-write 2021-08-29 21:35:40 -04:00
Edward Thomson
78cd76249c Merge pull request #5404 from lhchavez/multi-pack-index-write
midx: Add a way to write multi-pack-index files
2021-08-29 21:30:51 -04:00
Edward Thomson
9937967efd Merge branch 'main' into http-use-eauth 2021-08-29 21:29:14 -04:00
Edward Thomson
a5d6a5768f ci: stop on test failure 2021-08-29 21:01:49 -04:00
Edward Thomson
d2316d5746 buf: deprecate public git_buf writing functions
A `git_buf` is now a read-only structure as far as callers are
concerned.  This is a mechanism that we can return data to callers
using memory that is owned by the library and can be cleaned up by
callers (using `git_buf_dispose`).

A `git_buf` can no longer be allocated by callers or provided to the
library.
2021-08-29 13:13:03 -04:00
Edward Thomson
5bcef522f3 filter: deprecate apply function 2021-08-29 12:29:23 -04:00
Edward Thomson
7442c000d9 remote: deprecate resolve_url callback
Using a callback to set a resolve_url is not particularly idiomatic.
Deprecate it in favor of the `set_instance_url` and
`set_instance_pushurl` functions which can now be called from the
`git_remote_ready_cb` callback.
2021-08-29 10:39:28 -04:00
Edward Thomson
72df17c659 remote: introduce git_remote_ready_cb
Introduce a new callback that fires when the remote is ready to connect.
2021-08-29 10:39:28 -04:00
Edward Thomson
ef03e15038 rebase: deprecate signing_cb
The signing callback should not be used; instead, callers should provide
a commit_create_cb, perform the signing and commit creation themselves.
2021-08-29 10:16:56 -04:00
Edward Thomson
d3bdf33b58 rebase: introduce git_commit_create_cb
Introduce a new mechanism for `git_rebase_commit` for callers to
customize the experience.  Instead of assuming that we produce the
commit for them, provide a commit creation callback that allows callers
to produce the commit themselves and return the resulting commit id.
2021-08-29 10:16:29 -04:00
Edward Thomson
0a79012e9d Merge pull request #6015 from boretrk/c89-comments 2021-08-29 06:36:59 -04:00