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

Use HTTPS if available #874

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

nmaytan
Copy link
Contributor

@nmaytan nmaytan commented Jan 29, 2025

This change makes a newly created Tiled client switch to HTTPS, if available, if constructed using an HTTP argument as parameter.

This serves two purposes:

  • Prevents that client from hitting an HTTP->HTTPS redirect on every request
  • Prevents certain requests from breaking for clients created using an HTTP URL (such as a POST when redirects are setup to give 301 responses)

For example, here is a POST request to logout resulting in only one POST request, instead of a POST followed by redirected GET as would happen if HTTP were used:

In [4]: c = from_uri("http://tiled.nsls2.bnl.gov")

[...]

In [5]: c.logout()
14:57:39.140 -> (204 B) POST 'https://tiled.nsls2.bnl.gov/api/v1/auth/session/revoke' 'host:tiled.nsls2.bnl.gov' 'accept:*/*' [...]

Checklist

  • Add a Changelog entry
  • Add the ticket number which this PR closes to the comment section

@nmaytan nmaytan requested a review from danielballan January 29, 2025 20:07
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.

1 participant