Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

fix: use https URI when multiaddress specifies tls #177

Merged
merged 1 commit into from
May 15, 2023

Conversation

rossjones
Copy link
Contributor

Currently any clients created through NewApiWithClient will make a HTTP request to the api, even if the multiaddress specifies TLS or (the deprecated multiaddr option) https.

This commit addresses this by having NewApiWithClient iterate the available protocols for the multiaddress, specifying the URL proto as https if it finds TLS or HTTPS is specified. The default continues to be http for those multiaddresses that do not specify these options.

Should resolve #176

Currently any clients created through `NewApiWithClient` will make a
HTTP request to the api, even if the multiaddress specifies TLS or (the
deprecated multiaddr option) https.

This commit addresses this by having NewApiWithClient iterate the
available protocols for the multiaddress, specifying the URL proto as
https if it finds TLS or HTTPS is specified. The default continues to be
http for those multiaddresses that do not specify these options.

Should resolve ipfs#176
@welcome

This comment was marked as resolved.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you, looks sensible.

@lidel lidel changed the title Use https when multiaddress specifies tls fix: use https URI when multiaddress specifies tls May 15, 2023
@lidel lidel merged commit 7e1de1f into ipfs:master May 15, 2023
@lidel lidel mentioned this pull request May 15, 2023
@rossjones rossjones deleted the https branch May 15, 2023 16:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using NewApiWithClient uses HTTP even when HTTPS requested
3 participants