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

Apply TLS options even for non-HTTPS URLs #372

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

blyxxyz
Copy link
Collaborator

@blyxxyz blyxxyz commented Jun 7, 2024

TLS-related options were only being applied for URLs with a https:// scheme. But that's too cautious, because we could run into a HTTPS URL after a redirect.

I've fixed this by just removing the check. Another option is to also check args.follow, but I think it's nicer to do this stuff unconditionally. That way we can consistently give errors for bad options (e.g. --verify=path/wiht/typo).

Test case:

xh --verify=no --follow http://httpbin.org/redirect-to url==https://expired.badssl.com

Fixes #368.

TLS-related options were only being applied for URLs with a `https://`
scheme. But that's too cautious, because we could run into a HTTPS URL
after a redirect.

I've fixed this by just removing the check. Another option is to also
check `args.follow`, but I think it's nicer to do this stuff
unconditionally. That way we can consistently give errors for bad
options (e.g. `--verify=path/wiht/typo`).

Test case:
```shell
xh --verify=no --follow http://httpbin.org/redirect-to url==https://expired.badssl.com
```

Fixes ducaale#368.
Copy link
Owner

@ducaale ducaale left a comment

Choose a reason for hiding this comment

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

LGTM

@ducaale ducaale merged commit 7841303 into ducaale:master Jun 8, 2024
9 checks passed
@blyxxyz blyxxyz deleted the unconditional-tls-opts branch June 8, 2024 21:11
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.

--verify=no doesn't apply to redirects
2 participants