Skip to content

uri: support ports and split queries/fragments from path#825

Merged
ldennington merged 1 commit into
git-ecosystem:mainfrom
ldennington:support-ports
Mar 2, 2023
Merged

uri: support ports and split queries/fragments from path#825
ldennington merged 1 commit into
git-ecosystem:mainfrom
ldennington:support-ports

Conversation

@ldennington

@ldennington ldennington commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

GCM currently ignores ports in URIs. This means attempting to authenticate
to a URI with a port can lead to some unexpected behavior (e.g.
shortcutting the provider auto-detect process won't work, even if the
provider is set in config). This change adds support for ports by updating
GetGitConfigurationScopes() to recognize them.

This change also updates GetRemoteUri() to recognize paths with queries
and fragments, as that issue was uncovered during the implementation of
the GetGitConfigurationScopes() fix. Without it, input paths containing
queries and/or fragments get saved as part of Uri.Path, which converts the
query '?' and the fragment '#' to url encoding.

I validated these changes with unit tests for applicable scenarios and by
running a locally-compiled version of GCM with tracing enabled and the
following config set:

credential.http://localhost:7990/bitbucket.provider bitbucket

Trace logs showed that the override was recognized and auto-detection
was skipped.

Fixes #608

Rabbit9090

This comment was marked as spam.

Comment thread src/shared/Core/UriExtensions.cs Outdated
@ldennington
ldennington force-pushed the support-ports branch 4 times, most recently from 1878d15 to d46f426 Compare March 1, 2023 00:41
Comment thread src/shared/Core.Tests/InputArgumentsTests.cs Outdated
@ldennington ldennington changed the title uri extensions: support ports uri: support ports Mar 1, 2023
@ldennington
ldennington force-pushed the support-ports branch 5 times, most recently from 8f3e887 to 0d140b1 Compare March 2, 2023 02:02
@ldennington
ldennington marked this pull request as ready for review March 2, 2023 02:10
@ldennington ldennington changed the title uri: support ports uri: support ports and split queries/fragments from path Mar 2, 2023

@mjcheetham mjcheetham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one 'nit' question.

Comment thread src/shared/Core/InputArguments.cs Outdated
Comment thread src/shared/Core/InputArguments.cs
GCM currently ignores ports in URIs. This means attempting to authenticate
to a URI with a port can lead to some unexpected behavior (e.g.
shortcutting the provider auto-detect process won't work, even if the
provider is set in config). This change adds support for ports by updating
GetGitConfigurationScopes() to recognize them.

This change also updates GetRemoteUri() to recognize paths with queries
and fragments, as that issue was uncovered during the implementation of
the GetGitConfigurationScopes() fix. Without it, input paths containing
queries and/or fragments get saved as part of Uri.Path, which converts the
query '?' and the fragment '#' to url encoding.
@ldennington
ldennington merged commit ac08c91 into git-ecosystem:main Mar 2, 2023
mjcheetham added a commit that referenced this pull request May 2, 2023
**Changes:**

- Support ports in URL-scoped config (#825)
- Support URL-scoped enterprise default settings (#1149)
- Add support for client TLS certificates (#1152)
- Add TRACE2 support(#1131, #1151, #1156, #1162)
- Better browser detection inside of WSL (#1148)
- Handle expired OAuth refresh token for generic auth (#1196)
- Target *-latest runner images in CI workflow (#1178)
- Various bug fixes:
  - Ensure we create a WindowsProcessManager on Windows (#1146)
  - Ensure we start child processes created with ProcessManager (#1177)
  - Fix app path name of Windows dropping file extension (#1181)
  - Ensure we init IEnvironment before SessionManager (#1167)
  - git: consistently read from stdout before exit wait (#1136)
  - trace2: guard against null pipe client in dispose (#1135)
- Make Avalonia UI the default Windows and move to in-process (#1207)
- Add Git configuration options for trace & debug (#1228)
- Transition from Nerdbank.GitVersioning to a version file (#1231)
- Add support for using the current Windows user for WAM on DevBox
(#1197)
- Various documentation updates:
  - org-rename: update references to GitCredentialManager (#1141)
  - issue templates: remove core suffix (#1180)
  - readme: add link to project roadmap (#1204)
  - docs: add bitbucket app password requirements (#1213)
  - .net tool: clarify install instructions (#1126)
  - docs: call out different GCM install paths in WSL docs (#1168)
  - docs: add trace2 to config/env documentation (#1230)
@ldennington
ldennington deleted the support-ports branch July 12, 2023 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCM Settings does not support port numbers

3 participants