Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UserAgent encoding #40293

Conversation

FabianMeiswinkel
Copy link
Member

@FabianMeiswinkel FabianMeiswinkel commented May 21, 2024

Description

When customers use special characters (outside ASCII 0 - 127) in the user agent suffix attempts to connect to the service are blocked when the account is moved to ComputeGateway (it still works when the account is on Routing Gateway). The UserAgent is passed as an http header - and the HTTP spec has in the meantime updated to only allow ASCII characters for http headers (it was initially kept more vague/open - allowing ISO-8859-1) - but then later was narrowed down to ASCII based on the fact that the vast majority of HTTP stacks in the wild only supported ASCII anyway.

This PR masks all non-ASCII characters in UserAgent - by using its matching ASCII character if possible or replacing any remaining non-ASCII character with '_'

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - spark

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Azure Azure deleted a comment from azure-pipelines bot May 22, 2024
@FabianMeiswinkel FabianMeiswinkel changed the title Fix UserAgent eoncding Fix UserAgent encoding May 22, 2024
Copy link
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@FabianMeiswinkel
Copy link
Member Author

Test failures remaining are known flaky tests.

@FabianMeiswinkel
Copy link
Member Author

/check-enforcer override

@FabianMeiswinkel FabianMeiswinkel merged commit d73a9a3 into Azure:main May 22, 2024
76 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants