summaryrefslogtreecommitdiff
path: root/tests/online
Commit message (Collapse)AuthorAgeFilesLines
* online: test with https instead of git protocolethomson/test_httpsEdward Thomson2022-01-103-14/+5
| | | | | GitHub is removing support for the unauthenticated git protocol; test with the https protocol.
* tests: declare functions statically where appropriateEdward Thomson2021-11-112-3/+3
|
* path: separate git-specific path functions from utilEdward Thomson2021-11-092-5/+5
| | | | | | Introduce `git_fs_path`, which operates on generic filesystem paths. `git_path` will be kept for only git-specific path functionality (for example, checking for `.git` in a path).
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-176-70/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* remote: refactor proxy detectionEdward Thomson2021-09-011-61/+0
| | | | | | | | | | 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.
* Add NO_PROXY env supportMathieu Parent2021-09-011-0/+66
| | | | | | Item 2 of 3 from #4164 Signed-off-by: Mathieu Parent <math.parent@gmail.com>
* Merge pull request #6012 from libgit2/ethomson/custom_urlEdward Thomson2021-08-291-1/+1
|\ | | | | remote: introduce remote_ready_cb, deprecate resolve_url callback
| * remote: introduce git_remote_ready_cbEdward Thomson2021-08-291-1/+1
| | | | | | | | Introduce a new callback that fires when the remote is ready to connect.
* | opts: test GIT_OPT_SET_SSL_CERT_LOCATIONSEdward Thomson2021-08-292-0/+81
|/ | | | | Include a self-signed certificate for test.libgit2.org:1443 that we can use to verify that GIT_OPT_SET_SSL_CERT_LOCATIONS works.
* Add test for fetch proxy memleakpunkymaniac2021-06-161-0/+40
|
* winhttp: test proxy https cloneIan Hattendorf2021-03-011-0/+22
|
* badssl: RC4 should not fail with ECERTIFICATEcmn/rc4Edward Thomson2020-12-141-4/+2
| | | | | | Using RC4 is not a _certificate_ problem, it's a cipher problem. The SSL implementation should and will fail with an unrecoverable error (-1). There's no opportunity to accept/continue.
* badssl: re-enable RC4 testCarlos Martín Nieto2020-12-131-3/+0
| | | | | | This used to fail with an error indicating a mis-use of OpenSSL on platforms using it due to poor error handling. Re-enable it even if this isn't the right error code to use for now.
* refs: use git_reference_name_is_validEdward Thomson2020-10-251-1/+3
|
* clone: test that the origin HEAD is createdEdward Thomson2020-10-061-1/+6
| | | | | Ensure that we created `refs/remotes/origin/HEAD` when cloning, a symbolic link pointing to `refs/remotes/origin/<default>`
* Merge pull request #5536 from libgit2/ethomson/httpPatrick Steinhardt2020-06-031-0/+8
|\ | | | | httpclient: support googlesource
| * online::clone: test a googlesource URLEdward Thomson2020-06-011-0/+8
| | | | | | | | | | Google Git (googlesource.com) behaves differently than git proper. Test that we can communicate with it.
* | strarray: we should `dispose` instead of `free`Edward Thomson2020-06-012-3/+3
|/ | | | | | We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
* transports: http: fix custom headers not being appliedPatrick Steinhardt2020-02-071-0/+15
| | | | | | | | | | | | | | In commit b9c5b15a7 (http: use the new httpclient, 2019-12-22), the HTTP code got refactored to extract a generic HTTP client that operates independently of the Git protocol. Part of refactoring was the creation of a new `git_http_request` struct that encapsulates the generation of requests. Our Git-specific HTTP transport was converted to use that in `generate_request`, but during the process we forgot to set up custom headers for the `git_http_request` and as a result we do not send out these headers anymore. Fix the issue by correctly setting up the request's custom headers and add a test to verify we correctly send them.
* fetchhead: strip credentials from remote URLPatrick Steinhardt2020-01-311-0/+17
| | | | | | | | | | | | | | | | | | | | If fetching from an anonymous remote via its URL, then the URL gets written into the FETCH_HEAD reference. This is mainly done to give valuable context to some commands, like for example git-merge(1), which will put the URL into the generated MERGE_MSG. As a result, what gets written into FETCH_HEAD may become public in some cases. This is especially important considering that URLs may contain credentials, e.g. when cloning 'https://foo:bar@example.com/repo' we persist the complete URL into FETCH_HEAD and put it without any kind of sanitization into the MERGE_MSG. This is obviously bad, as your login data has now just leaked as soon as you do git-push(1). When writing the URL into FETCH_HEAD, upstream git does strip credentials first. Let's do the same by trying to parse the remote URL as a "real" URL, removing any credentials and then re-formatting the URL. In case this fails, e.g. when it's a file path or not a valid URL, we just fall back to using the URL as-is without any sanitization. Add tests to verify our behaviour.
* credential: change git_cred to git_credentialethomson/credtypeEdward Thomson2020-01-262-45/+45
| | | | | | | | | | | | | | | | We avoid abbreviations where possible; rename git_cred to git_credential. In addition, we have standardized on a trailing `_t` for enum types, instead of using "type" in the name. So `git_credtype_t` has become `git_credential_t` and its members have become `GIT_CREDENTIAL` instead of `GIT_CREDTYPE`. Finally, the source and header files have been renamed to `credential` instead of `cred`. Keep previous name and values as deprecated, and include the new header files from the previous ones.
* tests: allow users to use expect/continueEdward Thomson2020-01-242-0/+14
|
* tests: test that clone returns 4321Edward Thomson2020-01-241-2/+2
| | | | | This conditional was backwards. We should instead test that clone returns 4321, not that 4321 returns clone.
* test: add an azure repos testEdward Thomson2019-11-241-0/+6
| | | | | | | | We currently talk to Azure Repos for executing an online test (online::clone::path_whitespace). Add a simpler test to talk to Azure Repos to make it obvious that strange test failures are not likely the whitespace in the path, but actually a function of talking to Azure Repos itself.
* clone: Remove whitespace ssh testIan Hattendorf2019-08-131-15/+0
| | | | Will add later when infrastructure is configured
* clone: Update whitespace test urlIan Hattendorf2019-08-121-4/+4
|
* clone: whitespace in url ssh testIan Hattendorf2019-07-251-1/+17
|
* clone: whitespace in url testIan Hattendorf2019-07-241-0/+5
|
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-202-2/+2
| | | | | | | | | Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
* fetchhead: use size_t in testsEdward Thomson2019-06-241-5/+5
|
* winhttp: support default credentials for proxiesEdward Thomson2019-06-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | We did not properly support default credentials for proxies, only for destination servers. Refactor the credential handling to support sending either username/password _or_ default credentials to either the proxy or the destination server. This actually shares the authentication logic between proxy servers and destination servers. Due to copy/pasta drift over time, they had diverged. Now they share a common logic which is: first, use credentials specified in the URL (if there were any), treating empty username and password (ie, "http://:@foo.com/") as default credentials, for compatibility with git. Next, call the credential callbacks. Finally, fallback to WinHTTP compatibility layers using built-in authentication like we always have. Allowing default credentials for proxies requires moving the security level downgrade into the credential setting routines themselves. We will update our security level to "high" by default which means that we will never send default credentials without prompting. (A lower setting, like the WinHTTP default of "medium" would allow WinHTTP to handle credentials for us, despite what a user may have requested with their structures.) Now we start with "high" and downgrade to "low" only after a user has explicitly requested default credentials.
* network: don't add arbitrary url rulesEdward Thomson2019-06-101-6/+0
| | | | | There's no reason a git repository couldn't be at the root of a server, and URLs should have an implicit path of '/' when one is not specified.
* online tests: use gitlab for auth failuresethomson/auth_failureEdward Thomson2019-06-051-1/+1
| | | | | | | | GitHub recently changed their behavior from returning 401s for private or nonexistent repositories on a clone to returning 404s. For our tests that require an auth failure (and 401), move to GitLab to request a missing repository. This lets us continue to test our auth failure case, at least until they decide to mimic that decision.
* remote: add callback to resolve URLs before connectingErik Aigner2019-05-211-1/+1
| | | | | | Since libssh2 doesn't read host configuration from the config file, this callback can be used to hand over URL resolving to the client without touching the SSH implementation itself.
* indexer: use git_indexer_progress throughoutEdward Thomson2019-02-222-7/+7
| | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-2/+2
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* references: use new names in internal usageethomson/git_refEdward Thomson2019-01-171-3/+3
| | | | Update internal usage to use the `git_reference` names for constants.
* proxy: fix crash on remote connection with GIT_PROXY_AUTO but no proxy is ↵Jason Haslam2019-01-141-0/+7
| | | | detected
* tests: optionally ignore https cert validationEdward Thomson2018-11-281-0/+18
| | | | | | | | | | For testing, we may wish to use a man-in-the-middle proxy that can inspect the CONNECT traffic to our test endpoints. For this, we will need to accept the proxy's certificate, which will not be valid for the true endpoint. Add a new environment variable, GITTEST_REMOTE_SSL_NOVERIFY to disable https certificate validation for the tests.
* proxy tests: rename credential callbackEdward Thomson2018-11-281-2/+2
| | | | Rename credential callback to proxy_cred_cb to match new cert callback.
* proxy tests: support self-signed proxy certEdward Thomson2018-11-281-0/+30
| | | | | | | Give the proxy tests a proxy certificate callback, and allow self-signed certificates when the `GITTEST_REMOTE_PROXY_SELFSIGNED` environment variable is set (to anything). In that case, simply compare the hostname from the callback to the hostname that we connected to.
* tests: support optional PROXY_SCHEMEEdward Thomson2018-11-281-3/+12
| | | | | | | As we want to support HTTPS proxies, support an optional `GITTEST_REMOTE_PROXY_SCHEME` environment variable for tests that will allow for HTTPS support. (When unset, the tests default to HTTP proxies.)
* tests: PROXY_URL is more accurately PROXY_HOSTEdward Thomson2018-11-281-9/+9
| | | | | | | Change the `GITTEST_REMOTE_PROXY_URL` environment variable to be `GITTEST_REMOTE_PROXY_HOST`, since it is a host:port combination, not an actual URL. (We cannot use a URL here since we may want to include the username:password combination in the constructed URL.)
* online::clone: free url and username before resettingethomson/test_leakEdward Thomson2018-09-221-0/+6
| | | | | Before resetting the url and username, ensure that we free them in case they were set by environment variables.
* push tests: deeply free the specsEdward Thomson2018-07-201-1/+1
| | | | Don't just free the spec vector, also free the specs themselves.
* push tests: deeply free the push statusEdward Thomson2018-07-201-2/+6
| | | | | Don't just free the push status structure, actually free the strings that were strdup'd into the struct as well.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-104-11/+11
|
* Merge pull request #4556 from libgit2/ethomson/proxy_pass_in_envEdward Thomson2018-04-161-0/+36
|\ | | | | online::clone: validate user:pass in HTTP_PROXY
| * online::clone: validate user:pass in HTTP_PROXYethomson/proxy_pass_in_envEdward Thomson2018-02-281-0/+36
| | | | | | | | | | Validate using the http://user:pass@host/ format in HTTP_PROXY and HTTPS_PROXY environment variables.
* | online tests: update auth for bitbucket testethomson/bitbucketEdward Thomson2018-03-201-1/+1
| | | | | | | | | | Update the settings to use a specific read-only token for accessing our test repositories in Bitbucket.